/* web/static/css/pages/index.css
   Home â€” Ultra Luxe Crown
   Goals:
   - No context bar on home (base.html recommended)
   - Pastille API integrated in medallion (green/red)
   - Premium animations (reduced-motion safe)
   - NO SCROLLBAR on home
*/

/* ---------------------------- HARD NO-SCROLL (home) ---------------------------- */
/* Prefer scoping to home only. Use :has when available, fallback to html,body.
   This file is loaded only on the home page, so locking html is acceptable. */

@supports(selector(html:has(body.page-home))){
  html:has(body.page-home),
  body.page-home{
    height: 100%;
    min-height: 100dvh;
    overflow: clip;   /* modern */
    overflow: hidden; /* fallback */
    overscroll-behavior: none;
  }
}

/* Fallback for browsers without :has */
html, body{
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

/* Extra belt & braces */
.page-home{
  overflow: hidden; /* hard: no scrollbar */
  overscroll-behavior: none;
  /* prevents tiny â€œrubber-bandâ€ gestures creating scroll ghosts on some mobile UAs */
  touch-action: none;
}

/* base.html wraps content in .container.container--home on home */
.page-home .container--home{
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ---------------------------- Main layout override ---------------------------- */
.page-home main{
  /* override layout.css that reserves context-bar space */
  padding-top: calc(var(--header-h) + var(--space-md));
  padding-bottom: 0;
  min-height: calc(100dvh - var(--header-h));
  overflow: hidden;
}

/* belt & braces if context bar exists */
.page-home .context-bar{ display:none !important; }

/* optional: if footer still rendered */
.page-home .site-footer{ display:none !important; }

/* ---------------------------- Stage layout ---------------------------- */
.page-home .home-container{
  padding: 0; /* main already handles top space */
}

.page-home .home-stage{
  height: calc(100dvh - var(--header-h) - var(--space-md));
  width: min(980px, 94vw);
  margin: 0 auto;

  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 1rem;

  position: relative;
  isolation: isolate;
}

/* Ambient luxe background particles (subtle) */
.page-home .home-stage::before{
  content:"";
  position:absolute;
  inset:-40px;
  z-index:-2;
  background:
    radial-gradient(900px 520px at 50% 45%, rgba(124,139,255,.18), transparent 62%),
    radial-gradient(720px 420px at 32% 62%, rgba(56,189,248,.10), transparent 58%),
    radial-gradient(760px 440px at 68% 62%, rgba(168,85,247,.10), transparent 60%);
  filter: blur(2px);
  opacity: .9;
}

/* ---------------------------- Orbit / Crown ---------------------------- */
.page-home .home-orbit{
  position: relative;
  width: min(720px, 92vw);
  height: min(720px, 92vw);
  display: grid;
  place-items: center;

  --orbit-radius: clamp(150px, 22vw, 255px);
}

/* Luxury rotating ring */
.page-home .home-orbit::before{
  content:"";
  position:absolute;
  inset: 8%;
  border-radius: 999px;
  z-index: -2;

  background:
    conic-gradient(
      from 0deg,
      rgba(124,139,255,.00),
      rgba(124,139,255,.25),
      rgba(56,189,248,.18),
      rgba(168,85,247,.18),
      rgba(124,139,255,.25),
      rgba(124,139,255,.00)
    );
  filter: blur(.3px);
  opacity: .75;

  mask: radial-gradient(closest-side, transparent 73%, #000 74%);
  -webkit-mask: radial-gradient(closest-side, transparent 73%, #000 74%);

  animation: home-spin 18s linear infinite;
}

.page-home .home-orbit::after{
  content:"";
  position:absolute;
  inset: 16%;
  border-radius: 999px;
  z-index: -1;
  border: 1px solid rgba(255,255,255,.08);
  background: radial-gradient(closest-side, rgba(255,255,255,.02), transparent 72%);
  box-shadow: 0 30px 85px rgba(0,0,0,.60);
}

@keyframes home-spin{ to { transform: rotate(360deg); } }

/* Medallion */
.page-home .home-medallion{
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 30px;

  display: grid;
  place-items: center;

  border: 1px solid rgba(255,255,255,.14);
  background: var(--gradient-surface);
  box-shadow:
    var(--shadow-2),
    0 1px 0 rgba(255,255,255,.06) inset;

  backdrop-filter: blur(12px);

  animation: home-breathe 3.8s ease-in-out infinite;
}

@keyframes home-breathe{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-2px); }
}

.page-home .home-logo{
  width: 88px;
  height: auto;
  border-radius: 18px;
  box-shadow: none;
  border: 0;
  background: transparent;
  filter: saturate(1.05) contrast(1.02);
}

/* ---------------------------- API status dot + tooltip ---------------------------- */
.page-home .home-health-dot{
  position:absolute;
  top: 10px;
  right: 10px;
  width: 12px;
  height: 12px;
  border-radius: 999px;

  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 0 0 6px rgba(255,255,255,.06);

  transition: background .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.page-home .home-health-dot[data-state="checking"]{
  animation: home-dot-pulse 1.2s ease-in-out infinite;
}

.page-home .home-health-dot[data-state="up"]{
  background: rgba(53,208,127,.95);
  border-color: rgba(53,208,127,.55);
  box-shadow:
    0 0 0 6px rgba(53,208,127,.15),
    0 0 18px rgba(53,208,127,.25);
}

.page-home .home-health-dot[data-state="down"]{
  background: rgba(255,93,93,.95);
  border-color: rgba(255,93,93,.55);
  box-shadow:
    0 0 0 6px rgba(255,93,93,.16),
    0 0 18px rgba(255,93,93,.25);
  animation: home-dot-alert 1.1s ease-in-out infinite;
}

@keyframes home-dot-pulse{
  0%,100%{ box-shadow: 0 0 0 6px rgba(255,255,255,.06); opacity:.92; }
  50%{ box-shadow: 0 0 0 10px rgba(255,255,255,.04); opacity:1; }
}

@keyframes home-dot-alert{
  0%,100%{ transform: scale(1); }
  50%{ transform: scale(1.08); }
}

/* Tooltip */
.page-home .home-health-tip{
  position:absolute;
  bottom: -42px;
  left: 50%;
  transform: translateX(-50%);
  padding: .38rem .6rem;

  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(10,14,26,.62);
  color: rgba(255,255,255,.86);

  font-size: .85rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;

  backdrop-filter: blur(10px);
  transition: opacity .15s ease, transform .15s ease;
}

.page-home .home-medallion:hover .home-health-tip{
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* ---------------------------- Orbit items ---------------------------- */
.page-home .home-orbit-nav{
  position: absolute;
  inset: 0;
}

.page-home .home-orbit-item{
  position: absolute;
  top: 50%;
  left: 50%;

  transform:
    rotate(calc((360deg / var(--orbit-count)) * var(--i) - 90deg))
    translate(var(--orbit-radius))
    rotate(calc(-1 * ((360deg / var(--orbit-count)) * var(--i) - 90deg)));

  display: inline-flex;
  align-items: center;
  gap: .55rem;

  padding: .62rem .92rem;
  border-radius: 999px;

  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  box-shadow:
    0 12px 30px rgba(0,0,0,.38),
    0 1px 0 rgba(255,255,255,.05) inset;

  color: rgba(255,255,255,.94);
  text-decoration: none;
  font-weight: 720;
  font-size: .92rem;
  letter-spacing: .01em;
  min-height: 44px;

  backdrop-filter: blur(12px);

  transition:
    border-color .18s ease,
    background .18s ease,
    box-shadow .18s ease,
    transform .14s ease;

  animation: home-float 4.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * .22s);
}

@keyframes home-float{
  0%,100%{ translate: 0 0; }
  50%{ translate: 0 -2px; }
}

.page-home .home-orbit-item:hover{
  border-color: rgba(124,139,255,.34);
  background: linear-gradient(180deg, rgba(124,139,255,.14), rgba(255,255,255,.02));
  box-shadow:
    0 18px 44px rgba(0,0,0,.48),
    0 1px 0 rgba(255,255,255,.06) inset;
}

.page-home .home-orbit-item:focus-visible{
  outline: none;
  box-shadow:
    0 0 0 4px rgba(79,156,255,.18),
    0 18px 44px rgba(0,0,0,.48),
    0 1px 0 rgba(255,255,255,.06) inset;
}

.page-home .home-orbit-ico{
  width: 1.15rem;
  height: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-home .home-orbit-ico svg{
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .92;
}

.page-home .home-orbit-label{
  white-space: nowrap;
}

/* ---------------------------- Caption ---------------------------- */
.page-home .home-caption{
  width: min(720px, 92vw);
  text-align: center;
  padding: .85rem 1rem;

  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  box-shadow: 0 18px 50px rgba(0,0,0,.40);
}


.page-home .home-subtitle{
  margin: .25rem 0 0 0;
  color: rgba(255,255,255,.78);
  font-size: .95rem;
  line-height: 1.35;
}

/* SR utility if not already present */
.sr-only{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

/* ---------------------------- Mobile: orbit => grid, still no scroll ---------------------------- */
@media (max-width: 720px){
  .page-home .home-stage{
    gap: .75rem;
  }

  .page-home .home-orbit{
    width: min(560px, 94vw);
    height: auto;
    padding: .25rem .25rem 0;
  }

  .page-home .home-orbit::before,
  .page-home .home-orbit::after{
    display: none;
  }

  .page-home .home-medallion{
    width: 132px;
    height: 132px;
  }

  .page-home .home-logo{
    width: 82px;
  }

  .page-home .home-health-tip{
    display:none; /* mobile: avoid layout pressure */
  }

  .page-home .home-orbit-nav{
    position: static;
    width: 100%;
    margin-top: .9rem;

    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
  }

  .page-home .home-orbit-item{
    position: static;
    transform: none !important;
    width: 100%;
    justify-content: center;
    animation: none;
  }

  .page-home .home-caption{
    padding: .75rem .9rem;
  }
}

@media (max-width: 420px){
  .page-home .home-orbit-nav{
    grid-template-columns: 1fr;
  }
}

/* ---------------------------- Reduced motion ---------------------------- */
@media (prefers-reduced-motion: reduce){
  .page-home .home-orbit::before,
  .page-home .home-medallion,
  .page-home .home-orbit-item,
  .page-home .home-health-dot{
    animation: none !important;
  }
}
