/* ==========================================================================
   Safwa – Premium layer (hand-written, no build step required)
   Smooth scroll, preloader, scroll progress, back-to-top, WhatsApp chatbot,
   refined animations & micro-interactions.
   ========================================================================== */
:root {
	--sw-burgundy: #50111C;
	--sw-deep: #3E0B14;
	--sw-gold: #C5A16A;
	--sw-gold-2: #E2C48F;
	--sw-beige: #E9D9C2;
	--sw-ivory: #F8F2E9;
	--sw-ink: #351A1A;
	--sw-ease: cubic-bezier(.22, 1, .36, 1);
	--sw-shadow: 0 24px 60px -24px rgba(62, 11, 20, .55);
}

/* ---------- Lenis smooth scroll ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Global polish ---------- */
::selection { background: var(--sw-burgundy); color: var(--sw-ivory); }
html { scrollbar-color: var(--sw-burgundy) var(--sw-ivory); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--sw-ivory); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--sw-burgundy), var(--sw-deep)); border-radius: 10px; border: 2px solid var(--sw-ivory); }
:focus-visible { outline: 2px solid var(--sw-gold); outline-offset: 3px; }



/* Images: smoother, slower zoom */
.img-zoom img { transition: transform 1.2s var(--sw-ease) !important; }

/* ---------- Reveal variants (stagger set by JS) ---------- */
.js .reveal { transition: opacity 1s var(--sw-ease), transform 1s var(--sw-ease), filter 1s var(--sw-ease) !important; filter: blur(6px); }
.js .reveal.is-visible { filter: none; }
.js .reveal-left { opacity: 0; transform: translateX(-40px); }
.js .reveal-right { opacity: 0; transform: translateX(40px); }
.js .reveal-zoom { opacity: 0; transform: scale(.94); }
.js .reveal-left, .js .reveal-right, .js .reveal-zoom { transition: opacity 1.1s var(--sw-ease), transform 1.1s var(--sw-ease); }
.js .reveal-left.is-visible, .js .reveal-right.is-visible, .js .reveal-zoom.is-visible { opacity: 1; transform: none; }

/* Hero entrance */
.js .hero-content > * { opacity: 0; transform: translateY(30px); animation: sw-rise 1.2s var(--sw-ease) forwards; }
.js .hero-content > *:nth-child(1) { animation-delay: .25s; }
.js .hero-content > *:nth-child(2) { animation-delay: .4s; }
.js .hero-content > *:nth-child(3) { animation-delay: .6s; }
.js .hero-content > *:nth-child(4) { animation-delay: .75s; }
.js .hero-content > *:nth-child(5) { animation-delay: .9s; }
.js .hero-promise { opacity: 0; animation: sw-rise 1.2s 1s var(--sw-ease) forwards; }
.hero-slide { transform: scale(1.06); transition: opacity 1.6s ease, transform 8s ease-out !important; }
.hero-slide.opacity-100 { transform: scale(1); }
@keyframes sw-rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

/* Gold underline ornament for section titles */
.sw-ornament { display: flex; align-items: center; justify-content: center; gap: .75rem; margin: 1.25rem auto 0; color: var(--sw-gold); }
.sw-ornament::before, .sw-ornament::after { content: ""; height: 1px; width: 70px; background: linear-gradient(90deg, transparent, currentColor); }
.sw-ornament::after { transform: scaleX(-1); }
.sw-ornament i { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid currentColor; }


/* ---------- Scroll progress bar ---------- */
.sw-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--sw-burgundy), var(--sw-gold), var(--sw-gold-2)); pointer-events: none; }

/* ---------- Preloader ---------- */
.sw-loader { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #5c1622, var(--sw-deep)); transition: opacity .8s var(--sw-ease), visibility .8s; }
.sw-loader.is-done { opacity: 0; visibility: hidden; }
.sw-loader__inner { text-align: center; color: var(--sw-gold); }
.sw-loader__logo { font-family: "Prata", Georgia, serif; font-size: clamp(2.6rem, 6vw, 4rem); letter-spacing: .04em; background: linear-gradient(100deg, var(--sw-gold) 20%, #fff3d9 45%, var(--sw-gold) 70%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: sw-shimmer 2s linear infinite; }
.sw-loader__tag { display: block; margin-top: .3rem; font-size: 10px; letter-spacing: .4em; text-transform: uppercase; opacity: .75; }
.sw-loader__line { width: 140px; height: 1px; margin: 1.2rem auto 0; background: rgba(197, 161, 106, .25); overflow: hidden; }
.sw-loader__line::after { content: ""; display: block; height: 100%; width: 40%; background: var(--sw-gold); animation: sw-line 1.2s var(--sw-ease) infinite; }
@keyframes sw-shimmer { to { background-position: -250% 0; } }
@keyframes sw-line { from { transform: translateX(-100%); } to { transform: translateX(350%); } }

/* ---------- Floating stack (back-to-top + chat) ---------- */
.sw-totop { position: fixed; right: 26px; bottom: 100px; z-index: 55; width: 52px; height: 52px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; padding: 0; color: var(--sw-burgundy); background: var(--sw-ivory); box-shadow: 0 12px 30px -10px rgba(30,5,10,.55), 0 0 0 1px rgba(197,161,106,.5); opacity: 0; visibility: hidden; transform: translateY(20px) scale(.8); transition: opacity .5s var(--sw-ease), transform .5s var(--sw-ease), visibility .5s, background-color .3s, color .3s; }
.sw-totop.is-visible { opacity: 1; visibility: visible; transform: none; }
.sw-totop:hover { background: var(--sw-burgundy); color: var(--sw-gold); transform: translateY(-4px); }
.sw-totop svg.sw-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.sw-ring circle { fill: none; stroke-width: 2.5; }
.sw-ring .bg { stroke: rgba(197, 161, 106, .2); }
.sw-ring .fg { stroke: var(--sw-gold); stroke-linecap: round; stroke-dasharray: 151; stroke-dashoffset: 151; transition: stroke-dashoffset .15s linear; }
.sw-totop .sw-totop__arrow { position: relative; display: block; width: 20px; height: 20px; transition: transform .4s var(--sw-ease); }
.sw-totop:hover .sw-totop__arrow { transform: translateY(-3px); }

/* ---------- WhatsApp chatbot ---------- */
.sw-chat { position: fixed; right: 22px; bottom: 22px; z-index: 56; font-family: "Xmind", system-ui, sans-serif; }
.sw-chat__toggle { position: relative; width: 62px; height: 62px; border: 0; border-radius: 50%; cursor: pointer; color: #fff; display: grid; place-items: center; background: linear-gradient(145deg, #2fe07a, #1ebe5b); box-shadow: 0 14px 30px -10px rgba(30, 190, 91, .7); transition: transform .5s var(--sw-ease); }
.sw-chat__toggle:hover { transform: scale(1.08); }
.sw-chat__toggle::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #25D366; animation: sw-pulse 2.4s ease-out infinite; }
.sw-chat__toggle svg { width: 32px; height: 32px; transition: transform .5s var(--sw-ease), opacity .3s; }
.sw-chat__toggle .sw-x { position: absolute; width: 24px; height: 24px; opacity: 0; transform: rotate(-90deg); }
.sw-chat.is-open .sw-chat__toggle .sw-wa { opacity: 0; transform: rotate(90deg) scale(.5); }
.sw-chat.is-open .sw-chat__toggle .sw-x { opacity: 1; transform: none; }
.sw-chat.is-open .sw-chat__toggle::before { animation: none; opacity: 0; }
.sw-chat__badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--sw-burgundy); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; border: 2px solid #fff; transition: transform .3s; }
.sw-chat.is-open .sw-chat__badge, .sw-chat.is-seen .sw-chat__badge { transform: scale(0); }
@keyframes sw-pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }

.sw-chat__tip { position: absolute; right: 76px; bottom: 12px; white-space: nowrap; background: #fff; color: var(--sw-ink); font-size: 14px; padding: 10px 16px; border-radius: 12px 12px 2px 12px; box-shadow: var(--sw-shadow); opacity: 0; transform: translateX(10px); pointer-events: none; transition: opacity .5s var(--sw-ease), transform .5s var(--sw-ease); }
.sw-chat__tip b { color: var(--sw-burgundy); }
.sw-chat.show-tip .sw-chat__tip { opacity: 1; transform: none; }
.sw-chat.is-open .sw-chat__tip { opacity: 0; }

.sw-chat__panel { position: absolute; right: 0; bottom: 78px; width: 370px; max-width: calc(100vw - 32px); height: 540px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; overflow: hidden; border-radius: 20px; background: var(--sw-ivory); box-shadow: 0 40px 80px -30px rgba(30, 5, 10, .6), 0 0 0 1px rgba(197, 161, 106, .25); transform-origin: 100% 100%; opacity: 0; visibility: hidden; transform: translateY(16px) scale(.92); transition: opacity .45s var(--sw-ease), transform .45s var(--sw-ease), visibility .45s; }
.sw-chat.is-open .sw-chat__panel { opacity: 1; visibility: visible; transform: none; }

.sw-chat__head { position: relative; display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; color: var(--sw-ivory); background: linear-gradient(135deg, var(--sw-burgundy), var(--sw-deep)); }
.sw-chat__head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--sw-gold), transparent); }
.sw-chat__avatar { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-family: "Prata", Georgia, serif; font-size: 22px; color: var(--sw-burgundy); background: linear-gradient(145deg, var(--sw-gold-2), var(--sw-gold)); }
.sw-chat__avatar i { position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #2fe07a; border: 2px solid var(--sw-burgundy); }
.sw-chat__head strong { display: block; font-size: 16px; font-weight: 600; letter-spacing: .02em; }
.sw-chat__head small { font-size: 12px; opacity: .8; }
.sw-chat__close { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer; color: var(--sw-ivory); background: rgba(255, 255, 255, .1); font-size: 22px; line-height: 1; transition: background .3s, transform .4s var(--sw-ease); }
.sw-chat__close:hover { background: rgba(255, 255, 255, .2); transform: rotate(90deg); }

.sw-chat__body { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; background: radial-gradient(circle at 20% 0, rgba(197, 161, 106, .15), transparent 50%), var(--sw-ivory); }
.sw-msg { max-width: 85%; padding: 10px 14px; font-size: 14px; line-height: 1.5; border-radius: 16px; animation: sw-pop .45s var(--sw-ease) both; white-space: pre-line; }
.sw-msg--bot { align-self: flex-start; background: #fff; color: var(--sw-ink); border-bottom-left-radius: 4px; box-shadow: 0 6px 16px -10px rgba(62, 11, 20, .35); }
.sw-msg--user { align-self: flex-end; background: var(--sw-burgundy); color: var(--sw-ivory); border-bottom-right-radius: 4px; }
.sw-msg time { display: block; margin-top: 4px; font-size: 10px; opacity: .55; text-align: right; }
.sw-msg a.sw-msg__cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 14px; border-radius: 999px; background: #25D366; color: #fff; font-weight: 600; font-size: 13px; text-decoration: none; transition: transform .3s var(--sw-ease), box-shadow .3s; }
.sw-msg a.sw-msg__cta:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -10px rgba(37, 211, 102, .8); }
.sw-msg a.sw-msg__cta svg { width: 16px; height: 16px; }
.sw-msg a.sw-msg__link { display: inline-block; margin: 10px 8px 0 0; color: var(--sw-burgundy); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.sw-typing { align-self: flex-start; display: flex; gap: 4px; padding: 14px 16px; background: #fff; border-radius: 16px; border-bottom-left-radius: 4px; }
.sw-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--sw-gold); animation: sw-dot 1.2s infinite ease-in-out; }
.sw-typing span:nth-child(2) { animation-delay: .15s; }
.sw-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sw-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
@keyframes sw-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

.sw-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 16px 12px; }
.sw-chip { border: 1px solid rgba(80, 17, 28, .35); background: transparent; color: var(--sw-burgundy); padding: 7px 13px; border-radius: 999px; font-size: 13px; cursor: pointer; animation: sw-pop .4s var(--sw-ease) both; transition: background .3s, color .3s, border-color .3s, transform .3s var(--sw-ease); }
.sw-chip:hover { background: var(--sw-burgundy); color: var(--sw-ivory); border-color: var(--sw-burgundy); transform: translateY(-2px); }

.sw-chat__form { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid rgba(197, 161, 106, .3); background: #fff; }
.sw-chat__form input { flex: 1; min-width: 0; border: 1px solid rgba(197, 161, 106, .45); border-radius: 999px; padding: 11px 16px; font-size: 14px; background: var(--sw-ivory); color: var(--sw-ink); outline: none; transition: border-color .3s, box-shadow .3s; }
.sw-chat__form input:focus { border-color: var(--sw-gold); box-shadow: 0 0 0 3px rgba(197, 161, 106, .2); }
.sw-chat__form button { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: #fff; background: #25D366; transition: transform .3s var(--sw-ease), background .3s; }
.sw-chat__form button:hover { transform: scale(1.08); background: #1ebe5b; }
.sw-chat__form button svg { width: 18px; height: 18px; }
.sw-chat__foot { margin: 0; padding: 0 0 10px; text-align: center; font-size: 11px; color: rgba(53, 26, 26, .5); background: #fff; }

@media (max-width: 480px) {
	.sw-chat { right: 14px; bottom: 14px; }
	.sw-chat__panel { position: fixed; right: 12px; left: 12px; bottom: 88px; width: auto; max-width: none; height: min(560px, calc(100vh - 110px)); }
	.sw-totop { right: 18px; bottom: 88px; width: 48px; height: 48px; }
	.sw-chat__tip { display: none; }
}

/* Keep reveal animations even when the OS "Animation effects" setting is off */
.js .reveal:not(.is-visible) { opacity: 0 !important; transform: translateY(24px) !important; }

/* Chat avatar: Safwa logo */
.sw-chat__avatar { background: radial-gradient(circle at 35% 30%, #FFFDF8 0%, #F4E9D6 60%, #E2CDA8 100%) !important; box-shadow: 0 0 0 2px rgba(197,161,106,.85), 0 6px 14px -6px rgba(0,0,0,.5); overflow: visible; }
.sw-chat__avatar img { width: 80%; height: 80%; object-fit: contain; display: block; }
.sw-chat__avatar i { z-index: 1; }

/* ---------- Floating buttons: no overlap ---------- */
.sw-chat { right: 22px; bottom: 22px; }
.sw-chat__toggle { width: 60px; height: 60px; }
.sw-chat__toggle::before { animation-name: sw-pulse-sm; }
@keyframes sw-pulse-sm { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.28); opacity: 0; } }
.sw-totop { right: 26px; bottom: 116px; width: 52px; height: 52px; }   /* 22 + 60 + pulse room + gap */
.sw-chat__panel { bottom: 76px; }
.sw-chat.is-open ~ .sw-totop, body:has(.sw-chat.is-open) .sw-totop { opacity: 0; visibility: hidden; transform: translateY(10px) scale(.8); }
@media (max-width: 480px) {
	.sw-chat { right: 14px; bottom: 14px; }
	.sw-chat__toggle { width: 54px; height: 54px; }
	.sw-chat__toggle svg.sw-wa { width: 28px; height: 28px; }
	.sw-totop { right: 17px; bottom: 96px; width: 48px; height: 48px; }
	.sw-chat__panel { bottom: 80px; }
}
