/* ==========================================================================
   SITEKICKSTUDIO — Decorative scenes and animations
   ========================================================================== */

/* ---- Hero scene: a tilted wall of illustrated web pages ----
   Same art and palette as the Sitekickstudio section on coffeecup.com/freestuff
   (faint ink on near-black, ember accents). Back to front:
   wall (a tilted plane whose columns drift in a slow loop, leaning toward
   the pointer via Hero.js) → floats (a teammate's cursor and project
   notifications, in screen space) → veil (keeps the copy side clean). */
.hero__defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.hero__stage {
  position: absolute;
  inset: 0;
}

.hero__tilt {
  position: absolute;
  top: 50%;
  right: -7%;
  transform: translateY(-50%);
}

/* The base angles live in custom properties so Hero.js can read them
   and lean the wall from there without fighting the breakpoints. */
.hero__wall {
  --wall-persp: 1800px;
  --wall-rx: 24deg;
  --wall-ry: -14deg;
  --wall-rz: 10deg;
  --wall-scale: 1;
  display: grid;
  grid-template-columns: repeat(3, 240px);
  gap: 28px;
  transform: perspective(var(--wall-persp)) rotateX(var(--wall-rx)) rotateY(var(--wall-ry)) rotateZ(var(--wall-rz)) scale(var(--wall-scale));
}

/* Staggered resting offsets, as on the freestuff wall */
.hero__col:nth-child(2) { margin-top: -120px; }
.hero__col:nth-child(3) { margin-top: 40px; }

/* Each track holds its five pages twice, so moving it by half its
   height loops without a seam. Gaps are margins (not flex gap) so
   that half is exact. */
.hero__track {
  display: flex;
  flex-direction: column;
  animation: hero-col-up 84s linear infinite;
  will-change: transform;
}

.hero__col:nth-child(2) .hero__track {
  animation-name: hero-col-down;
  animation-duration: 100s;
}

.hero__col:nth-child(3) .hero__track { animation-duration: 72s; }

@keyframes hero-col-up {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -50%, 0); }
}

@keyframes hero-col-down {
  from { transform: translate3d(0, -50%, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

.hero__page {
  display: block;
  flex-shrink: 0;
  width: 240px;
  height: 300px;
  margin-bottom: 28px;
  overflow: visible;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.55));
  /* Build-in: the pages rise in on a diagonal (--i = row + column) */
  animation: hero-page-in 1.2s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 90ms + 0.15s);
}

@keyframes hero-page-in {
  from { opacity: 0; transform: translateY(56px) scale(0.94); }
}

/* Page illustration palette. Plain class selectors: they reach the
   <use> clones (an ancestor selector would not). The accent is a custom
   property (inherited into the clones), so one drawing can be shown in
   another brand colour: <svg style="--pg-accent:#…">. Default: ember. */
.pg-frame { fill: url(#skg-frame); stroke: rgba(245, 243, 239, 0.12); }
.pg-bar { fill: rgba(245, 243, 239, 0.035); }
.pg-sep { fill: none; stroke: rgba(245, 243, 239, 0.08); }
.pg-dot { fill: rgba(245, 243, 239, 0.2); }
.pg-t { font-family: var(--font-body); font-weight: 450; fill: rgba(245, 243, 239, 0.86); }
.pg-t--h { font-weight: 550; letter-spacing: -0.035em; fill: var(--text); }
.pg-t--b { font-weight: 600; }
.pg-t--m { fill: rgba(245, 243, 239, 0.45); }
.pg-t--ember { fill: var(--pg-accent-text, #ff8a5c); font-weight: 600; }
.pg-t--price { fill: var(--pg-accent-text, #ff8a5c); font-weight: 600; letter-spacing: -0.02em; }
.pg-t--dark { fill: var(--bg); }
.pg-line { fill: rgba(245, 243, 239, 0.12); }
.pg-block { fill: rgba(245, 243, 239, 0.06); }
.pg-icon { fill: rgba(245, 243, 239, 0.22); }
.pg-ink { fill: rgba(245, 243, 239, 0.72); }
.pg-pill { fill: rgba(245, 243, 239, 0.12); }
.pg-pill-strong { fill: var(--text); }
.pg-outline { fill: none; stroke: rgba(245, 243, 239, 0.16); }
.pg-ring { fill: none; stroke: var(--pg-accent, var(--sk-ember)); stroke-width: 1.2; }
.pg-ringc { fill: none; stroke: rgba(245, 243, 239, 0.7); }
.pg-ember { fill: var(--pg-accent, var(--sk-ember)); }
.pg-ember-soft { fill: color-mix(in srgb, var(--pg-accent, #ff5a1f) 16%, transparent); }
.pg-hl { fill: color-mix(in srgb, var(--pg-accent, #ff5a1f) 7%, transparent); stroke: color-mix(in srgb, var(--pg-accent, #ff5a1f) 60%, transparent); }
.pg-active { fill: color-mix(in srgb, var(--pg-accent, #ff5a1f) 14%, transparent); }
.pg-glass { fill: rgba(10, 10, 10, 0.6); stroke: rgba(255, 255, 255, 0.14); }
.pg-tip { fill: var(--text); }
.pg-halo { fill: color-mix(in srgb, var(--pg-accent, #ff5a1f) 22%, transparent); }
.pg-grid { fill: none; stroke: rgba(245, 243, 239, 0.06); }
.pg-area { fill: url(#skg-area); }
.pg-stroke { fill: none; stroke: var(--pg-accent, var(--sk-ember)); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pg-img1 { fill: url(#skg-img1); }
.pg-img2 { fill: url(#skg-img2); }
.pg-img3 { fill: url(#skg-img3); }
.pg-img4 { fill: url(#skg-img4); }
.pg-shine { fill: url(#skg-shine); }
.pg-wash { fill: rgba(255, 255, 255, 0.22); }
.pg-wash-strong { fill: rgba(255, 255, 255, 0.85); }
.pg-vase { fill: url(#skg-vase); }
.pg-shadow { fill: rgba(0, 0, 0, 0.4); }
.pg-avatar { fill: url(#skg-avatar); }
.pg-swatch1 { fill: #e8ded0; }
.pg-swatch2 { fill: #3a332b; stroke: rgba(245, 243, 239, 0.2); }

/* ---- Floats: cursor and notifications (screen space, above the wall) ---- */
.hero__floats {
  position: absolute;
  inset: 0;
  font-family: var(--font-body);
  color: var(--text);
}

/* The teammate's cursor works its way across the pages, resting on each */
.hero__cursor {
  position: absolute;
  top: 22%;
  left: 60%;
  display: flex;
  align-items: flex-start;
  gap: 2px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5));
  animation:
    hero-float-in 0.8s var(--ease-out) 1.2s both,
    hero-cursor 20s var(--ease-in-out) 2.4s infinite;
}

.hero__cursor span {
  margin-top: 14px;
  padding: 4px 9px;
  border-radius: 99px 99px 99px 4px;
  background: var(--sk-ember);
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--text-on-accent);
  white-space: nowrap;
}

@keyframes hero-float-in {
  from { opacity: 0; }
}

@keyframes hero-cursor {
  0%, 10%   { transform: translate(0, 0); }
  22%, 34%  { transform: translate(190px, 130px); }
  46%, 58%  { transform: translate(40px, 290px); }
  70%, 82%  { transform: translate(-70px, 120px); }
  100%      { transform: translate(0, 0); }
}

/* Notifications take turns in one slot. Static (no JS, motion
   paused, reduced motion): only the first one shows. */
.hero__toasts {
  position: absolute;
  left: 57%;
  bottom: 12%;
}

.hero__toast {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 10px;
  border-radius: var(--radius-md);
  background: rgba(22, 21, 19, 0.84);
  border: 1px solid rgba(245, 243, 239, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
  opacity: 0;
}

.hero__toast:first-child { opacity: 1; }

html:not(.motion-paused) .hero__toast {
  animation: hero-toast 12s var(--ease-out) infinite both;
  animation-delay: calc(var(--t, 0) * 4s + 1.6s);
}

@keyframes hero-toast {
  0%       { opacity: 0; transform: translateY(16px) scale(0.96); }
  5%, 30%  { opacity: 1; transform: none; }
  35%, 100% { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

.hero__toast-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sk-ember);
  color: var(--text-on-accent);
}

.hero__toast-icon svg { width: 15px; height: 15px; }

.hero__toast-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.2;
}

.hero__toast-text strong { font-size: 13px; font-weight: var(--fw-bold); }
.hero__toast-text span { font-size: 11.5px; color: var(--text-dim); }

/* ---- Veil: copy side stays near-black, the wall fades out at the
   top and bottom, ember light pools under it ---- */
.hero__veil {
  --veil-fade: 30%;
  position: absolute;
  inset: 0;
  /* Top layer first: the vertical fade sits over the ember light so the
     hero always ends in solid near-black, with no visible seam */
  background:
    linear-gradient(180deg, var(--bg) 0%, rgba(10, 10, 10, 0.72) 9%, rgba(10, 10, 10, 0) 24%, rgba(10, 10, 10, 0) 76%, var(--bg) 100%),
    radial-gradient(ellipse 44% 48% at 76% 88%, rgba(255, 90, 31, 0.2), transparent 70%),
    linear-gradient(90deg,
      var(--bg) var(--veil-fade),
      rgba(10, 10, 10, 0.78) calc(var(--veil-fade) + 14%),
      rgba(10, 10, 10, 0.22) calc(var(--veil-fade) + 40%),
      rgba(10, 10, 10, 0.32) 100%);
}

.hero .text-dim { color: rgba(245, 243, 239, 0.56); }
.hero__lead { color: rgba(245, 243, 239, 0.74); }

/* Leaving the hero, the scene sinks and dims (scroll-driven, no JS) */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .hero__stage {
      animation: hero-stage-exit linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }
  }
}

@keyframes hero-stage-exit {
  to { transform: translate3d(0, 24vh, 0); opacity: 0.3; }
}

/* Mid widths: the copy column reaches further right, so the wall steps back */
@media (min-width: 1024px) and (max-width: 1279px) {
  .hero__tilt { right: -20%; }
  .hero__veil { --veil-fade: 38%; }
  .hero__inner > * { max-width: 540px; }
  .hero__cursor { left: 64%; }
  .hero__toasts { left: 60%; }
}

/* Tablet and phone: the wall sits under the copy, at the bottom */
@media (max-width: 1023px) {
  .hero__tilt {
    top: auto;
    bottom: 0;
    right: 50%;
    transform: translate(62%, 50%);
  }
  .hero__wall { --wall-scale: 0.86; }
  .hero__cursor { display: none; }
  .hero__toasts { left: auto; right: var(--edge); bottom: 32px; }
  .hero__toast { left: auto; right: 0; }
  .hero__veil {
    background:
      linear-gradient(180deg, var(--bg) 46%, rgba(10, 10, 10, 0.6) 64%, rgba(10, 10, 10, 0.25) 84%, var(--bg) 100%),
      radial-gradient(ellipse 70% 36% at 70% 92%, rgba(255, 90, 31, 0.2), transparent 70%);
  }
}

@media (max-width: 720px) {
  .hero__wall { --wall-scale: 0.66; }
  .hero__tilt { transform: translate(60%, 46%); }
  .hero__veil {
    background:
      linear-gradient(180deg, var(--bg) 58%, rgba(10, 10, 10, 0.6) 72%, rgba(10, 10, 10, 0.25) 86%, var(--bg) 100%),
      radial-gradient(ellipse 90% 30% at 60% 92%, rgba(255, 90, 31, 0.2), transparent 70%);
  }
}

/* Motion paused or reduced: the wall and its pages are simply there */
html.motion-paused .hero__page,
html.motion-paused .hero__cursor {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero__page,
  .hero__track,
  .hero__cursor,
  .hero__toast {
    animation: none !important;
  }
  .hero__toast:not(:first-child) { opacity: 0; }
}

/* ---- Marquee (pure CSS loop) ---- */
.marquee {
  display: flex;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}

.marquee__track {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
  padding-right: var(--sp-3);
  animation: marquee 32s linear infinite;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.2rem);
  color: var(--text-faint);
  white-space: nowrap;
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-h2);
}

.marquee__track span:nth-child(2n) { color: var(--border-strong); }

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track {
    animation: none !important;
  }
}

/* ---- Contact glow ---- */
.contact__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 55% at 62% 50%, rgba(255, 90, 31, 0.16) 0%, transparent 70%);
  /* Fades to nothing at both edges so the light never shows a seam */
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  z-index: 0;
}
