/* ============================================================
   Webdesign.ee — AVALEHE disainikiht (ainult <body class="home">)
   Laetakse pärast style.css-i; teisi lehti see fail ei mõjuta.

   Põhimõtted (liikumine):
     • sisenemised — ease-out, hover/vajutus alla 250 ms;
     • animeerime ainult transform + opacity (erand: hero pealkirja blur);
     • hover-efektid ainult hiirega seadmetel;
     • vajutusel nupp «vajub» (scale 0.97) — kohene tagasiside.
   ============================================================ */

.home {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --hh: 86px;            /* päise kõrgus — hero ulatub selle alla */
}

/* ---------- Päis: hero kohal läbipaistev, kerides klaasjas ---------- */
.home .site-header {
  background: transparent;
  backdrop-filter: none;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.home .site-header.scrolled {
  background: rgba(9, 16, 30, 0.78);
  backdrop-filter: blur(14px) saturate(1.3);
}

/* ---------- Nupud: kiire ja täpne tagasiside ---------- */
.home .btn {
  transition: transform 0.16s var(--ease-out), box-shadow 0.2s ease,
              border-radius 0.3s var(--ease-out), border-color 0.2s ease;
}
.home .btn:active { transform: scale(0.97); }
.home .btn-arrow:active { transform: scale(0.98); }
@media (hover: none) {
  .home .btn:hover, .home .btn-arrow:hover { transform: none; }
}

/* ============================================================
   HERO
   ============================================================ */
.home .hero {
  margin-top: calc(-1 * var(--hh));
  padding: calc(var(--hh) + clamp(3rem, 9vh, 6rem)) 0 clamp(9rem, 20vh, 12.5rem);
  min-height: 100vh;
  min-height: min(100svh, 1040px);
  display: flex;
  align-items: center;
  /* varuvariant, kuni canvas pole joonistatud (või JS on väljas) */
  background: radial-gradient(ellipse at 28% 0%, #132240 0%, #0a1322 55%, #060a13 100%);
}
.home .hero::before { display: none; }     /* vana pöörlev aurora */
#spaceCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.4s ease;
}
#spaceCanvas.on { opacity: 1; }
/* Loetavuskate: tumendab vasakut serva teksti all ning sulatab
   hero alumise serva lehe taustaga kokku */
.home .hero::after {
  background:
    linear-gradient(90deg, rgba(6, 10, 19, 0.74) 0%, rgba(6, 10, 19, 0.42) 36%, rgba(6, 10, 19, 0) 66%),
    linear-gradient(180deg, rgba(6, 10, 19, 0.5) 0%, rgba(6, 10, 19, 0) 17%,
                    rgba(15, 27, 49, 0) 76%, var(--bg) 100%);
}
.home .hero-inner { max-width: none; }

.home .hero .tag { margin-bottom: 0; color: #b4c4ff; }

.home .hero h1 {
  font-size: clamp(2.2rem, 6.1vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin: 1.1rem 0 1.5rem;
}
/* Pealkirja read «sõidavad» maski alt välja */
.h1-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}
.h1-line > span { display: block; }
.h1-sub {
  display: block;
  margin-top: 1.15rem;
  max-width: 21em;
  font-size: clamp(1.12rem, 2.1vw, 1.7rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: #cfd9ef;
}
.home .hero-sub {
  max-width: 560px;
  font-size: clamp(1rem, 1.35vw, 1.12rem);
  color: #b3c0d8;
  margin-bottom: 2.2rem;
}
.home .hero-cta { margin-bottom: 2.4rem; }
.home .hero-badges { gap: 0.6rem; }
.home .hero-badges li {
  padding: 0.45rem 0.95rem 0.45rem 0.75rem;
  font-size: 0.88rem;
  color: #c8d3ea;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm);
}

/* --- Hero sisenemine: astmeline, ease-out, kerge udu --- */
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
}
@keyframes h1-line-up {
  from { transform: translateY(112%); }
}
.home .hero .rise { transition: none; transform: none; }
.home .hero .rise.on {
  opacity: 1;
  animation: hero-rise 0.9s var(--ease-out) backwards;
}
.home .hero .tag.rise.on       { animation-delay: 0.1s; }
.home .hero .hero-sub.rise.on  { animation-delay: 0.62s; }
.home .hero .hero-cta.rise.on  { animation-delay: 0.74s; }
.home .hero .hero-badges.rise.on { animation-delay: 0.86s; }
.home .hero h1.rise.on { animation: none; }
.home .hero h1.rise.on .h1-line > span {
  animation: h1-line-up 1.05s var(--ease-out) backwards;
}
.home .hero h1.rise.on .h1-line:nth-child(1) > span { animation-delay: 0.18s; }
.home .hero h1.rise.on .h1-line:nth-child(2) > span { animation-delay: 0.3s; }
.home .hero h1.rise.on .h1-sub {
  animation: hero-rise 0.9s var(--ease-out) 0.5s backwards;
}

/* ============================================================
   NUMBRID — klaasist «dokk», mis ulatub hero alumisele servale
   ============================================================ */
.home .stats {
  z-index: 3;
  margin-top: -4.4rem;
  padding: 0;
  background: none;
  animation: none;
}
.home .stats::before,
.home .stats::after { display: none; }
.home .stats-grid {
  gap: 0;
  padding: 1.5rem 0.5rem;
  background: linear-gradient(180deg, rgba(24, 37, 68, 0.66), rgba(12, 21, 40, 0.74));
  border: 1px solid rgba(148, 170, 210, 0.2);
  border-radius: var(--r-card);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
/* gradientjoon doki ülaserval */
.home .stats-grid::before {
  content: "";
  position: absolute;
  left: 24px; right: 8px; top: -1px;
  height: 1px;
  background: var(--grad);
  -webkit-mask: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  mask: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}
.home .stat { padding: 0.2rem 1rem; }
.home .stat + .stat { border-left: 1px solid var(--line); }
.home .stat-num { font-size: clamp(2rem, 3.6vw, 3rem); letter-spacing: -0.03em; line-height: 1.1; }

/* ============================================================
   SEKTSIOONID — üks pidev «kosmos», mitte vahelduvad ribad
   ============================================================ */
.home .section-alt {
  background: linear-gradient(180deg, rgba(24, 38, 70, 0.5), rgba(18, 30, 56, 0.42));
  border-block: 1px solid rgba(148, 170, 210, 0.08);
}
.home .section-dark {
  background: radial-gradient(ellipse at 80% 0%, rgba(20, 33, 61, 0.7) 0%, rgba(7, 12, 23, 0.86) 60%);
}
.home .section h2 {
  font-size: clamp(1.75rem, 3.6vw, 2.85rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: 20em;
  text-wrap: balance;
}
.home .section-sub { font-size: 1.08rem; text-wrap: pretty; }

/* --- Ilmumine kerimisel: keyframe (mitte transition), et hover-üleminekud
       jääksid kiireks; veerupõhine aste --- */
@keyframes home-rise {
  from { opacity: 0; transform: translateY(16px); }
}
.home .rise { transform: none; transition: none; }
.home .rise.on {
  opacity: 1;
  animation: home-rise 0.65s var(--ease-out) backwards;
  animation-delay: var(--d, 0s);
}
.home :is(.services-grid, .ai-grid, .stats-grid) > .rise:nth-child(4n+2) { --d: 0.06s; }
.home :is(.services-grid, .ai-grid, .stats-grid) > .rise:nth-child(4n+3) { --d: 0.12s; }
.home :is(.services-grid, .ai-grid, .stats-grid) > .rise:nth-child(4n+4) { --d: 0.18s; }
.home :is(.process-grid, .why-grid, .reviews-grid) > .rise:nth-child(3n+2) { --d: 0.07s; }
.home :is(.process-grid, .why-grid, .reviews-grid) > .rise:nth-child(3n+3) { --d: 0.14s; }

/* --- Kaardid: kiired hover-üleminekud + «prožektor» kursori all --- */
.home :is(.card, .ai-item, .step, .why-item, .review-card) {
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s ease,
              border-color 0.2s ease, border-radius 0.35s var(--ease-out),
              background-color 0.2s ease;
}
.home :is(.card, .ai-item, .step, .review-card) { isolation: isolate; }
.home :is(.card, .ai-item, .step, .review-card)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 0%),
              rgba(122, 92, 255, 0.2), rgba(46, 107, 255, 0.06) 45%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .home :is(.card, .ai-item, .step, .review-card):hover::before { opacity: 1; }
}
@media (hover: none) {
  .home :is(.card, .ai-item, .step, .why-item, .review-card):hover { transform: none; }
}

/* ---------- Teenused: bento-võrk ---------- */
.home .card { padding: 1.9rem 1.6rem 1.7rem; }
.home .card-wide { grid-column: span 2; }
.home .card-featured {
  padding: 2.3rem 2.1rem 2rem;
  min-height: 300px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(122, 92, 255, 0.22), transparent 60%) padding-box,
    linear-gradient(#131d36, #101a30) padding-box,
    var(--grad) border-box;
}
.home .card-featured:hover {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(122, 92, 255, 0.3), transparent 62%) padding-box,
    linear-gradient(#162140, #121d37) padding-box,
    var(--grad) border-box;
}
.home .card-featured .card-icon { width: 64px; height: 64px; margin-bottom: 1.3rem; }
.home .card-featured .card-icon svg { width: 38px; height: 38px; }
.home .card-featured h3 { font-size: clamp(1.3rem, 2vw, 1.65rem); letter-spacing: -0.02em; }
.home .card-featured p { font-size: 1.02rem; max-width: 38ch; }
.home .card-featured .card-price strong,
.home .card-wide .card-price strong {
  font-size: 2rem;
  letter-spacing: -0.03em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home .card-wide {
  background:
    radial-gradient(110% 120% at 100% 100%, rgba(255, 107, 74, 0.14), transparent 60%),
    var(--surface);
}
.home .card-link { transition: color 0.2s ease; }
.home .card-link:hover { color: #fff; text-decoration: none; }

/* ---------- Protsess: suured numbrid + «marsruudi» joon ---------- */
.home .step { padding: 1.7rem 1.6rem 1.7rem; }
.home .step-num {
  display: flex;
  justify-content: flex-start;
  width: 100%; height: auto;
  margin-bottom: 0.9rem;
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: -0.04em;
  border-radius: 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home .step-num::before { content: "0"; }
.home .step-num::after {
  content: "";
  flex: 1;
  height: 1px;
  margin-left: 0.9rem;
  background: linear-gradient(90deg, rgba(122, 92, 255, 0.65), rgba(46, 107, 255, 0.2) 60%, transparent);
}

/* ---------- Arvustused ---------- */
.home .review-card { padding: 1.9rem 1.7rem 1.7rem; }
.home .review-card blockquote { font-size: 1rem; color: #d2dbee; }

/* ---------- KKK: sujuv avanemine (kus brauser toetab) ---------- */
@supports (interpolate-size: allow-keywords) {
  .home .faq { interpolate-size: allow-keywords; }
  .home .faq details::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 0.28s var(--ease-out), content-visibility 0.28s allow-discrete;
  }
  .home .faq details[open]::details-content { block-size: auto; }
}
.home .faq summary { transition: color 0.2s ease; }
@media (hover: hover) and (pointer: fine) {
  .home .faq summary:hover { color: #fff; }
}

/* ---------- Kontaktivorm: klaas ---------- */
.home .contact-form {
  background: linear-gradient(160deg, rgba(26, 39, 72, 0.78), rgba(13, 22, 42, 0.82));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* ============================================================
   ADAPTIIV
   ============================================================ */
@media (max-width: 1024px) {
  .home .card-featured { min-height: 0; }
}
@media (max-width: 768px) {
  .home .hero {
    align-items: flex-start;
    padding-bottom: 12rem;
  }
  /* kitsal ekraanil on tekst kogu laiuses — kate ühtlasem */
  .home .hero::after {
    background:
      linear-gradient(180deg, rgba(6, 10, 19, 0.62) 0%, rgba(6, 10, 19, 0.42) 50%,
                      rgba(6, 10, 19, 0) 76%, rgba(15, 27, 49, 0) 91%, var(--bg) 100%);
  }
  .home .stats { margin-top: -5.6rem; }
  .home .stats-grid { padding: 0.6rem 0.4rem; }
  .home .stat { padding: 1rem 0.6rem; }
  .home .stat:nth-child(odd) { border-left: 0; }
  .home .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .home { --hh: 64px; }
  .home .card-wide { grid-column: span 1; }
  .home .hero-badges li { width: 100%; }
  .home .hero .tag { font-size: 0.7rem; letter-spacing: 0.14em; }
}

@media (prefers-reduced-motion: reduce) {
  .home .rise.on,
  .home .hero .rise.on,
  .home .hero h1.rise.on .h1-line > span,
  .home .hero h1.rise.on .h1-sub { animation: none; }
  #spaceCanvas { transition: none; }
}
