/* ==========================================================
   Rushikesh & Nishita — core design system
   "The Palace Garden Gatefold" · a Luxvites invitation
   Palette from the printed card: celadon, ivory paper, blush,
   rose-gold foil, sage leaf, wine script — accented by the
   couple's mauve sherwani and magenta silk.
   ========================================================== */
:root {
  --ivory: #fbf7f0;
  --paper: #f6eee2;
  --paper-2: #eee2d1;
  --mint: #e1f0ea;
  --mint-2: #bfdccf;
  --celadon: #8fc0ae;
  --celadon-deep: #4c8573;
  --blush: #f5d9d3;
  --rose: #e3a7a3;
  --rose-deep: #c4767a;
  --rosegold: #b47a63;
  --rosegold-lt: #e9c2aa;
  --sage: #a9b98f;
  --mauve: #bba6c1;
  --magenta: #b8235f;
  --wine: #561831;
  --wine-2: #3c0f22;
  --ink: #3a2530;
  --muted: #806a72;

  --foil: linear-gradient(110deg, #9c5f4a 0%, #ecc7ae 22%, #b47a63 40%, #f9e2d2 55%, #b47a63 70%, #8e5541 100%);
  --foil-deep: linear-gradient(110deg, #7e4634 0%, #c08a6f 25%, #8e5541 45%, #d6a487 62%, #9c5f4a 80%, #7e4634 100%);
  --shadow: 0 40px 90px -40px rgba(86, 24, 49, .45), 0 2px 8px rgba(86, 24, 49, .05);

  --script: 'Pinyon Script', cursive;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --caps: 'Cinzel', serif;
  --sans: 'Jost', system-ui, sans-serif;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
  --gut: clamp(16px, 5vw, 64px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 70px; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-variant-numeric: lining-nums;
  margin: 0; background: var(--ivory); color: var(--ink);
  font-family: var(--serif); font-size: clamp(17px, .6vw + 14px, 20px); line-height: 1.6;
  overflow-x: clip; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.locked { overflow: hidden; height: 100svh; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--blush); color: var(--wine); }
:focus-visible { outline: 2px solid var(--rosegold); outline-offset: 3px; }

/* handmade-paper grain */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .4 0 0 0 0 .35 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- type ---------- */
.foil-text {
  background: var(--foil-deep); background-size: 260% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: foil 6s var(--ease-io) infinite alternate;
}
@keyframes foil { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

.chapter { position: relative; z-index: 3; padding: clamp(90px, 13vw, 180px) var(--gut); overflow-x: clip; }
.welcome, .footer { overflow-x: clip; }
.ch-head { text-align: center; margin: 0 auto clamp(44px, 7vw, 90px); max-width: 900px; }
.ch-num { display: block; font-family: var(--caps); font-size: .78rem; letter-spacing: .5em; color: var(--rosegold); margin-bottom: .9rem; }
.ch-num.light { color: var(--rosegold-lt); }
.ch-title { text-wrap: balance; margin: 0; font-family: var(--script); font-weight: 400; color: var(--wine); font-size: clamp(3rem, 8vw, 6.4rem); line-height: 1.05; }
.ch-sub { margin: 1rem 0 0; font-style: italic; color: var(--muted); font-size: 1.1rem; }
.divider { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--rosegold); margin: 2.2rem 0; }
.divider span { height: 1px; width: min(110px, 20vw); background: linear-gradient(90deg, transparent, var(--rosegold)); }
.divider span:last-child { transform: scaleX(-1); }
.divider svg { width: 46px; height: 30px; }

/* ---------- buttons ---------- */
.btn {
  --h: 52px; position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .7em;
  height: var(--h); padding: 0 1.9em; border: 0; border-radius: 999px; text-decoration: none;
  font-family: var(--caps); font-size: .7rem; letter-spacing: .24em; text-transform: uppercase;
  transition: transform .6s var(--ease), box-shadow .6s var(--ease), background-color .4s, color .4s;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-foil { color: #fff; background: var(--foil); background-size: 220% 100%; box-shadow: 0 14px 34px -14px rgba(180, 122, 99, .95); }
.btn-foil::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .6) 50%, transparent 70%);
  transform: translateX(-130%); transition: transform 1s var(--ease);
}
.btn-foil:hover::after { transform: translateX(130%); }
.btn-foil:hover { box-shadow: 0 20px 44px -14px rgba(180, 122, 99, 1); }
.btn-line { --h: 44px; font-size: .62rem; color: var(--wine); background: rgba(255, 255, 255, .4); border: 1px solid rgba(180, 122, 99, .5); }
.btn-line:hover { background: var(--wine); color: var(--ivory); border-color: var(--wine); }

/* ---------- cursor ---------- */
#cursor, #cursorDot { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; display: none; }
@media (pointer: fine) {
  .has-cursor, .has-cursor * { cursor: none !important; }
  .has-cursor #cursor, .has-cursor #cursorDot { display: block; }
  #cursorDot { width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--wine); }
  #cursor {
    width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; border: 1px solid rgba(180, 122, 99, .6);
    display: grid; place-items: center;
    transition: width .5s var(--ease), height .5s var(--ease), margin .5s var(--ease), background-color .4s, border-color .4s;
  }
  #cursor.hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: rgba(245, 217, 211, .4); border-color: var(--rose); }
  #cursor.view { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: rgba(86, 24, 49, .88); border-color: transparent; }
  .cur-label { font-family: var(--caps); font-size: .58rem; letter-spacing: .25em; color: var(--ivory); opacity: 0; transition: opacity .3s; }
  #cursor.view .cur-label { opacity: 1; }
}

/* ---------- progress + petals ---------- */
#progress { position: fixed; top: 0; left: 0; z-index: 130; width: 100%; height: 2px; transform-origin: 0 50%; transform: scaleX(0); background: var(--foil); }
#petals { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 80; pointer-events: none; }

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 42%, #fff 0%, var(--ivory) 50%, var(--mint) 150%);
  transition: opacity 1s var(--ease), visibility 1s;
}
#loader.done { opacity: 0; visibility: hidden; }
.ld-center { text-align: center; }
.ld-ganesha { width: 104px; height: 104px; color: var(--rosegold); }
.ld-ganesha use { stroke-dasharray: 420; stroke-dashoffset: 420; animation: draw 2.2s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ld-shloka { margin: .6rem 0 0; font-style: italic; letter-spacing: .08em; color: var(--wine); opacity: 0; animation: rise 1.2s .8s var(--ease) forwards; }
.ld-bar { width: 150px; height: 1px; margin: 1.3rem auto 0; overflow: hidden; background: rgba(180, 122, 99, .2); }
.ld-bar span { display: block; height: 100%; background: var(--foil); transform: translateX(-101%); animation: bar 2.2s var(--ease-io) forwards; }
@keyframes bar { to { transform: none; } }
.ld-brand { position: absolute; left: 0; right: 0; bottom: 26px; margin: 0; display: flex; justify-content: center; align-items: center; gap: 8px; font-family: var(--caps); font-size: .6rem; letter-spacing: .32em; text-transform: uppercase; color: var(--rosegold); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Luxvites floating badge ---------- */
.lv-badge {
  position: fixed; left: 14px; bottom: 14px; z-index: 900; display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 7px; border-radius: 999px; text-decoration: none;
  background: rgba(251, 247, 240, .8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(180, 122, 99, .35); box-shadow: 0 10px 26px -14px rgba(86, 24, 49, .4);
  font-family: var(--sans); font-size: .68rem; letter-spacing: .05em; color: var(--muted);
  opacity: 0; transform: translateY(20px); transition: opacity .8s var(--ease), transform .8s var(--ease), box-shadow .5s;
}
.entered .lv-badge { opacity: 1; transform: none; }
.lv-badge b { font-weight: 500; letter-spacing: .14em; color: var(--wine); }
.lv-badge img { animation: lvTurn 12s var(--ease-io) infinite; }
.lv-badge:hover { box-shadow: 0 16px 34px -14px rgba(86, 24, 49, .5); }
@keyframes lvTurn { 0%, 80% { transform: rotate(0); } 100% { transform: rotate(360deg); } }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120; display: flex; align-items: center; gap: 24px;
  padding: 20px var(--gut); opacity: 0; pointer-events: none;
  transition: opacity 1s var(--ease), transform .7s var(--ease), background-color .5s, padding .5s var(--ease), box-shadow .5s;
}
.entered .nav { opacity: 1; pointer-events: auto; }
.nav.solid { background: rgba(251, 247, 240, .84); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding-top: 10px; padding-bottom: 10px; box-shadow: 0 1px 0 rgba(180, 122, 99, .2); }
.nav.tuck { transform: translateY(-105%); }
.nav.menu { backdrop-filter: none; -webkit-backdrop-filter: none; background: transparent; box-shadow: none; transform: none; }
.nav-mono, .ft-mono { font-family: var(--script); font-size: 2.1rem; line-height: 1; color: var(--wine); text-decoration: none; }
.nav-mono i, .ft-mono i { font-family: var(--serif); font-size: .5em; font-style: italic; color: var(--rosegold); margin: 0 .18em; }
.nav-links { display: flex; gap: clamp(16px, 2.3vw, 36px); margin-left: auto; }
.nav-links a { position: relative; padding: 6px 0; font-family: var(--caps); font-size: .64rem; letter-spacing: .22em; text-transform: uppercase; text-decoration: none; color: var(--wine); }
.nav-links a em { font-style: normal; font-size: .85em; color: var(--rosegold); margin-right: .55em; }
.nav-links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--rosegold); transform: scaleX(0); transform-origin: right; transition: transform .6s var(--ease); }
.nav-links a:hover::after, .nav-links a.on::after { transform: scaleX(1); transform-origin: left; }
.nav-lv img { transition: transform 1s var(--ease); }
.nav-lv:hover img { transform: rotate(90deg) scale(1.08); }
.nav-burger { display: none; position: relative; width: 44px; height: 44px; margin-left: auto; border: 0; background: none; }
.nav-burger span { position: absolute; left: 11px; right: 11px; height: 1px; background: var(--wine); transition: transform .6s var(--ease); }
.nav-burger span:first-child { top: 18px; } .nav-burger span:last-child { top: 26px; }
.nav-burger[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

@media (max-width: 960px) {
  .nav { gap: 10px; }
  .nav-burger { display: block; }
  .nav-links {
    position: fixed; inset: 0; z-index: -1; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
    background: radial-gradient(ellipse at 50% 30%, #fff, var(--ivory) 55%, var(--mint) 160%);
    clip-path: circle(0 at calc(100% - 44px) 36px); transition: clip-path 1s var(--ease-io);
  }
  .nav-links.open { clip-path: circle(150% at calc(100% - 44px) 36px); }
  .nav-links a { font-size: .95rem; }
  .nav-links.open a { animation: rise .9s var(--ease) both; }
  .nav-links.open a:nth-child(2) { animation-delay: .06s; } .nav-links.open a:nth-child(3) { animation-delay: .12s; }
  .nav-links.open a:nth-child(4) { animation-delay: .18s; } .nav-links.open a:nth-child(5) { animation-delay: .24s; }
  .nav-links.open a:nth-child(6) { animation-delay: .3s; }
}

/* ---------- reveal system (active only when JS runs) ---------- */
.js .rv, .js .rv-left, .js .rv-right, .js .rv-scale {
  opacity: 0; transition: opacity 1.3s var(--ease), transform 1.3s var(--ease), filter 1.3s var(--ease); transition-delay: var(--d, 0s);
}
.js .rv { transform: translateY(44px); }
.js .rv-left { transform: translateX(-70px); }
.js .rv-right { transform: translateX(70px); }
.js .rv-scale { transform: scale(.9); filter: blur(8px); }
.js .in { opacity: 1; transform: none; filter: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #petals { display: none; }
}
