/* Public landing page. Uses only the tokens from sdz.css, so day/night mode and any future re-theme apply here too.
   Contrast: white on the navy hero is above 12:1; navy ink on the gold accent (#f5b301) is about 9:1.

   Motion is progressive and always optional:
   - hidden "before" states exist only while <html> has `home-js` and not `home-show` / `home-ready`-revealed items,
   - prefers-reduced-motion switches every animation off and shows everything at once. */

/* ---------- Hero ---------- */
.home-hero {
  position: relative; overflow: hidden; color: #fff; padding: 3.25rem 0 3.5rem;
  background:
    radial-gradient(600px 300px at 85% 10%, rgba(245,179,1,.16), transparent 70%),
    radial-gradient(520px 320px at 5% 90%, rgba(79,70,229,.45), transparent 70%),
    linear-gradient(135deg, var(--sdz-side) 0%, #272f6b 60%, var(--sdz-primary) 140%);
}
.home-hero h1 { font-weight: 800; letter-spacing: .01em; margin-bottom: .6rem; }
.home-hero h2 { font-weight: 800; margin-bottom: .6rem; }
.home-hero .lead { max-width: 38rem; color: rgba(255,255,255,.88); }
.hero-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; margin-bottom: .9rem; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.hero-chip i { color: var(--sdz-accent); font-size: 1rem; }
.btn-gold { background: var(--sdz-accent); border: 1px solid var(--sdz-accent); color: #14193a; font-weight: 700; }
.btn-gold:hover { filter: brightness(1.07); color: #14193a; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,.55); color: #fff; font-weight: 600; }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.home-hero .btn { transition: transform .15s ease, filter .15s ease, background-color .15s ease; }
.home-hero .btn:hover { transform: translateY(-2px); }

.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 56px; display: block; }
.hero-wave path { fill: var(--sdz-bg); }

/* floating lottery balls in the background */
.hero-balls { position: absolute; inset: 0; pointer-events: none; transition: transform .25s ease-out; }
.fb {
  position: absolute; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.05rem;
  color: #14193a; opacity: .22; box-shadow: inset -6px -8px 14px rgba(0,0,0,.18), inset 5px 6px 10px rgba(255,255,255,.5);
  animation: fb-float 9s ease-in-out infinite;
}
.fb1 { left: 3%;  top: 14%; background: #ffd24d; animation-delay: -1s; }
.fb2 { left: 12%; top: 66%; background: #ff8d8d; width: 40px; height: 40px; font-size: .85rem; animation-delay: -4s; }
.fb3 { left: 46%; top: 8%;  background: #a9b6ff; width: 34px; height: 34px; font-size: .75rem; animation-delay: -2s; }
.fb4 { right: 6%; top: 12%; background: #8ee0ab; animation-delay: -6s; }
.fb5 { right: 14%; top: 70%; background: #ffd24d; width: 44px; height: 44px; font-size: .9rem; animation-delay: -3s; }
.fb6 { left: 58%; top: 74%; background: #ff8d8d; width: 30px; height: 30px; font-size: .7rem; animation-delay: -7s; }
@keyframes fb-float { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-18px) rotate(8deg); } }

/* hero carousel */
.hero-carousel .carousel-item { transition: opacity .6s ease; }
.hero-copy .hero-latest {
  max-width: 34rem; padding: .9rem 1rem; border-radius: var(--sdz-radius);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(4px);
}
.hl-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--sdz-accent); font-weight: 800; margin-bottom: .3rem; }
.hl-date { font-size: .82rem; color: rgba(255,255,255,.78); }
.hero-controls { display: flex; align-items: center; gap: .5rem; margin-top: 1.6rem; }
.hero-controls .carousel-indicators { position: static; margin: 0 .5rem 0 0; justify-content: flex-start; gap: 0; }
.hero-controls .carousel-indicators [data-bs-target] {
  width: 28px; height: 6px; margin: 0 4px 0 0; border: 0; border-radius: 999px; background: rgba(255,255,255,.4); opacity: 1; transition: width .25s ease, background-color .25s ease;
}
.hero-controls .carousel-indicators .active { width: 46px; background: var(--sdz-accent); }
.hc-btn, .tc-btn {
  width: 40px; height: 40px; min-height: 40px; display: inline-grid; place-items: center; padding: 0; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.4); font-size: 1.15rem; transition: background-color .15s ease, transform .15s ease;
}
.hc-btn:hover, .tc-btn:hover { background: rgba(255,255,255,.26); transform: scale(1.06); }
.age-badge {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; flex: none;
  border: 2px solid var(--sdz-accent); color: var(--sdz-accent); font-weight: 800; font-size: .8rem;
}

/* hero illustrations */
.hero-art { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; filter: drop-shadow(0 18px 28px rgba(0,0,0,.35)); }
.hero-art text { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hero-art .drum-balls, .hero-art .drop-ball, .hero-art .phone-body, .hero-art .phone-badge, .hero-art .receipt-sheet, .hero-art .receipt-seal {
  transform-box: fill-box; transform-origin: center;
}
.hero-art .drum-balls { animation: drum-spin 16s linear infinite; }
.hero-art .drum-balls text { animation: drum-counter 16s linear infinite; transform-box: fill-box; transform-origin: center; }
.hero-art .drop-ball { animation: ball-drop 3.2s ease-in infinite; }
.hero-art .phone-body { animation: art-bob 5s ease-in-out infinite; }
.hero-art .phone-badge { animation: art-pop 3s ease-in-out infinite; }
.hero-art .receipt-sheet { animation: art-bob 6s ease-in-out infinite; }
.hero-art .receipt-seal { animation: art-pop 3.4s ease-in-out infinite; }
@keyframes drum-spin { to { transform: rotate(360deg); } }
@keyframes drum-counter { to { transform: rotate(-360deg); } }
@keyframes ball-drop { 0% { transform: translateY(-34px); opacity: 0; } 15% { opacity: 1; } 60% { transform: translateY(22px); } 75% { transform: translateY(14px); } 90%,100% { transform: translateY(22px); opacity: 1; } }
@keyframes art-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes art-pop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }

/* staggered entrance of the active slide's copy */
.hero-carousel .carousel-item.active .hero-copy > * { animation: hero-in .7s cubic-bezier(.2,.7,.2,1) both; }
.hero-carousel .carousel-item.active .hero-copy > *:nth-child(2) { animation-delay: .08s; }
.hero-carousel .carousel-item.active .hero-copy > *:nth-child(3) { animation-delay: .16s; }
.hero-carousel .carousel-item.active .hero-copy > *:nth-child(4) { animation-delay: .24s; }
.hero-carousel .carousel-item.active .hero-copy > *:nth-child(5) { animation-delay: .32s; }
.hero-carousel .carousel-item.active .hero-art { animation: art-in .8s cubic-bezier(.2,.7,.2,1) both; }
@keyframes hero-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes art-in  { from { opacity: 0; transform: scale(.88) translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- Latest-results ticker ---------- */
.home-ticker { background: var(--sdz-side); border-bottom: 1px solid rgba(255,255,255,.08); overflow: hidden; color: #fff; }
.ticker-track { display: flex; width: max-content; animation: ticker 55s linear infinite; }
.home-ticker:hover .ticker-track, .home-ticker:focus-within .ticker-track { animation-play-state: paused; }
.ticker-group { display: flex; flex: none; align-items: center; gap: 2.25rem; padding: .55rem 1.1rem; }
.ticker-item { display: inline-flex; align-items: center; gap: .6rem; white-space: nowrap; font-size: .85rem; }
.ticker-item b { color: var(--sdz-accent); font-weight: 700; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- Stats ---------- */
.home-stats { margin-top: -1.6rem; position: relative; z-index: 2; }
.stat-tile {
  background: var(--sdz-surface); border: 1px solid var(--sdz-line); border-radius: var(--sdz-radius); padding: 1rem .5rem;
  box-shadow: 0 .6rem 1.4rem rgba(20,25,58,.1);
}
.stat-tile i { font-size: 1.6rem; color: var(--sdz-primary); }
.stat-tile .num { font-size: 1.7rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-tile .lbl { font-size: .78rem; color: var(--sdz-muted); font-weight: 600; }

/* ---------- Sections ---------- */
.home-section { padding-top: 2.25rem; }
.home-section h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 1rem; position: relative; padding-left: .85rem; }
.home-section h2::before { content: ""; position: absolute; left: 0; top: .2em; bottom: .2em; width: 4px; border-radius: 4px; background: var(--sdz-accent); }

.open-chip { display: flex; align-items: center; gap: .75rem; }
.open-chip .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--sdz-success); flex: none; box-shadow: 0 0 0 4px rgba(22,163,74,.18); animation: live-dot 2s ease-out infinite; }
.open-chip .time { font-variant-numeric: tabular-nums; }
@keyframes live-dot { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 100% { box-shadow: 0 0 0 10px rgba(22,163,74,0); } }
.cd-label { display: block; font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sdz-muted); font-weight: 700; }
.cd-value { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

/* games rail */
.games-rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
.game-tile {
  display: flex; flex-direction: column; align-items: center; gap: .55rem; padding: 1rem .75rem; text-align: center; text-decoration: none; color: var(--sdz-ink);
  background: var(--sdz-surface); border: 1px solid var(--sdz-line); border-radius: var(--sdz-radius); position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.game-tile:hover { color: var(--sdz-ink); border-color: var(--sdz-primary); transform: translateY(-4px); box-shadow: 0 .8rem 1.5rem rgba(20,25,58,.15); }
.gt-art { width: 84px; height: 84px; border-radius: 18px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, var(--sdz-primary), #272f6b); }
.gt-art img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.game-tile:hover .gt-art img { transform: scale(1.08); }
.gt-initial { font-size: 2rem; font-weight: 900; color: var(--sdz-accent); }
.gt-name { font-weight: 800; font-size: .92rem; line-height: 1.2; }
.gt-state { font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; gap: .35rem; color: var(--sdz-muted); }
.gt-state.is-open { color: var(--sdz-success); }
.gt-state .dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
:root[data-theme="dark"] .gt-state.is-open { color: #6ee7a0; }

/* results cards: balls pop in when the card appears */
.result-card { transition: transform .18s ease, box-shadow .18s ease; }
.home-section .result-card:hover { transform: translateY(-3px); }
.home-js .result-card.is-in .ball { animation: ball-pop .5s cubic-bezier(.2,.9,.3,1.4) both; }
.home-js .result-card.is-in .ball:nth-child(2) { animation-delay: .07s; }
.home-js .result-card.is-in .ball:nth-child(3) { animation-delay: .14s; }
.home-js .result-card.is-in .ball:nth-child(4) { animation-delay: .21s; }
.home-js .result-card.is-in .ball:nth-child(5) { animation-delay: .28s; }
.home-js .result-card.is-in .ball:nth-child(n+6) { animation-delay: .35s; }
@keyframes ball-pop { from { opacity: 0; transform: scale(.3) translateY(10px); } to { opacity: 1; transform: none; } }
.ball { box-shadow: inset -3px -4px 7px rgba(0,0,0,.14), inset 2px 3px 5px rgba(255,255,255,.55); }

/* how it works */
.how-steps .card { position: relative; overflow: hidden; }
.step-icon { position: relative; display: inline-block; margin-bottom: .6rem; }
.step-icon > i { font-size: 2.4rem; color: var(--sdz-primary); }
.step-num {
  position: absolute; right: -1.1rem; top: -.35rem; display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--sdz-accent); color: #14193a; font-weight: 800; font-size: .85rem; margin: 0;
}
@media (min-width: 768px) {
  .how-steps > div:not(:last-child) .card::after {
    content: "\f061"; font-family: "Line Awesome Free"; font-weight: 900; position: absolute; right: .5rem; top: .6rem; color: var(--sdz-line); font-size: 1.4rem;
  }
}

/* trust */
.trust-card > .card-body > i { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 14px; font-size: 1.7rem; margin-bottom: .6rem; background: rgba(79,70,229,.12); color: var(--sdz-primary); transition: transform .25s ease, background-color .25s ease, color .25s ease; }
.trust-card:hover > .card-body > i { transform: rotate(-8deg) scale(1.1); background: var(--sdz-primary); color: #fff; }
:root[data-theme="dark"] .trust-card > .card-body > i { color: #b4baff; }

/* number shuffler */
.shuffler { background: linear-gradient(135deg, rgba(79,70,229,.1), rgba(245,179,1,.12)); border: 1px solid var(--sdz-line); }
.shuffler .balls { gap: .55rem; min-height: 56px; }
.shuffler .ball { width: 52px; height: 52px; font-size: 1.15rem; }
.shuffler .ball.spin { animation: ball-pop .45s cubic-bezier(.2,.9,.3,1.4) both; }

/* testimonials */
.testi-carousel { max-width: 46rem; margin: 0 auto; }
.testi-card {
  position: relative; margin: 0; padding: 2rem 1.75rem 1.5rem; text-align: center; border-radius: var(--sdz-radius);
  background: var(--sdz-surface); border: 1px solid var(--sdz-line); box-shadow: 0 .6rem 1.4rem rgba(20,25,58,.08);
}
.testi-mark { position: absolute; top: -1.1rem; left: 50%; transform: translateX(-50%); width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--sdz-accent); color: #14193a; font-size: 1.4rem; }
.testi-card blockquote { font-size: 1.08rem; line-height: 1.6; margin: .4rem 0 1.1rem; }
.testi-card figcaption { display: inline-flex; align-items: center; gap: .6rem; font-size: .9rem; }
.testi-avatar { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--sdz-primary); color: #fff; font-weight: 800; }
.testi-carousel .carousel-item { transition: transform .5s ease, opacity .5s ease; }
.testi-controls { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: 1.1rem; }
.testi-controls .tc-btn { background: var(--sdz-surface); color: var(--sdz-ink); border-color: var(--sdz-line); }
.testi-controls .tc-btn:hover { background: var(--sdz-primary); color: #fff; border-color: var(--sdz-primary); }
.testi-controls .carousel-indicators { position: static; margin: 0; gap: 0; }
.testi-controls .carousel-indicators [data-bs-target] { width: 10px; height: 10px; border: 0; border-radius: 50%; margin: 0 4px; background: var(--sdz-line); opacity: 1; transition: background-color .2s ease, transform .2s ease; }
.testi-controls .carousel-indicators .active { background: var(--sdz-primary); transform: scale(1.3); }

/* FAQ */
.home-faq .accordion-item { background: var(--sdz-surface); border-color: var(--sdz-line); color: var(--sdz-ink); }
.home-faq .accordion-button { background: var(--sdz-surface); color: var(--sdz-ink); font-weight: 700; box-shadow: none; }
.home-faq .accordion-button:not(.collapsed) { background: rgba(79,70,229,.08); color: var(--sdz-primary); }
:root[data-theme="dark"] .home-faq .accordion-button:not(.collapsed) { color: #b4baff; }
:root[data-theme="dark"] .home-faq .accordion-button::after { filter: invert(1) brightness(1.6); }
.home-faq .accordion-button:focus-visible { outline: 3px solid var(--sdz-accent); outline-offset: -3px; }

/* writer call to action */
.cta-card { border: 0; color: #fff; background: linear-gradient(120deg, var(--sdz-side), #272f6b 55%, var(--sdz-primary)); overflow: hidden; position: relative; }
.cta-card::after { content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(245,179,1,.18); pointer-events: none; }
.cta-card h2 { color: #fff; padding-left: 0; }
.cta-card h2::before { display: none; }
.cta-card .text-muted { color: rgba(255,255,255,.8) !important; }
.cta-card .btn--outline--primary { color: #fff; border-color: rgba(255,255,255,.6); }
.cta-card .btn--outline--primary:hover { background: rgba(255,255,255,.16); color: #fff; }
.cta-card .card-body { position: relative; z-index: 1; }

/* responsible play */
.play-safe { display: flex; align-items: center; gap: .9rem; margin-top: 2rem; padding: .9rem 1.1rem; border-radius: var(--sdz-radius); background: rgba(245,179,1,.12); border: 1px solid rgba(245,179,1,.4); }
.play-safe .age-badge { color: var(--sdz-warning); border-color: var(--sdz-warning); }
:root[data-theme="dark"] .play-safe .age-badge { color: var(--sdz-accent); border-color: var(--sdz-accent); }

.home-link { color: var(--sdz-link, var(--sdz-primary)); font-weight: 600; }
.home-link:hover { text-decoration: underline; }

/* phone quick actions + scroll helpers */
.mobile-cta { display: none; }
@media (max-width: 767.98px) {
  .home-page { padding-bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px)); }
  .mobile-cta {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; display: flex; gap: .6rem; padding: .6rem .9rem calc(.6rem + env(safe-area-inset-bottom, 0px));
    background: var(--sdz-surface); border-top: 1px solid var(--sdz-line); box-shadow: 0 -6px 18px rgba(20,25,58,.12);
  }
  .mobile-cta .btn { flex: 1 1 0; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
  .home-hero { padding: 2.25rem 0 3rem; }
  .fb { opacity: .14; }
}
.scroll-bar { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 2000; transform: scaleX(0); transform-origin: 0 50%; background: linear-gradient(90deg, var(--sdz-accent), var(--sdz-primary)); pointer-events: none; }
.to-top {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 1034; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--sdz-primary); color: #fff; border: 0; font-size: 1.3rem; box-shadow: 0 6px 16px rgba(79,70,229,.45);
  opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.to-top.is-on { opacity: 1; visibility: visible; transform: none; }
@media (max-width: 767.98px) { .to-top { bottom: calc(4.8rem + env(safe-area-inset-bottom, 0px)); } }

/* scroll reveal: hidden only while JS is about to reveal it */
.home-js:not(.home-show) [data-reveal] { opacity: 0; transform: translateY(22px); }
.home-js:not(.home-show) [data-reveal].is-in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.home-show [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  .home-section .card { transition: transform .15s ease, box-shadow .15s ease; }
  .home-section .card:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1.25rem rgba(20,25,58,.12); }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .fb, .hero-art *, .ticker-track, .open-chip .dot, .hero-carousel .carousel-item.active * { animation: none !important; }
  .ticker-track { overflow-x: auto; }
}
