.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.theme-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-toggle-track {
  position: relative;
  width: 2.6rem;
  height: 1.45rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.6);
  transition: background 200ms ease, border-color 200ms ease;
}

.theme-toggle-track::after {
  content: "";
  position: absolute;
  top: 0.1rem;
  left: 0.12rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 9999px;
  background: #dbeafe;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.45);
  transition: transform 200ms ease, background 200ms ease;
}

.theme-toggle-label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #dbeafe;
}

.site-logo {
  display: block;
}

.site-logo-anchor {
  position: relative;
  left: -18px;
}

@media (min-width: 768px) {
  .site-logo-anchor {
    left: -30px;
  }
}

.frontier-avatar {
  position: relative;
  z-index: 8;
  display: block;
  width: 2.35rem;
  height: 2.35rem;
  object-fit: cover;
  object-position: center;
  border-radius: 9999px;
  border: none;
  background: transparent;
  box-shadow: 0 6px 16px rgba(2, 6, 23, 0.34);
  animation: softFloat 6.4s ease-in-out infinite;
}

.service-carousel {
  position: relative;
  border-radius: 1rem;
  border: 1px solid rgba(125, 211, 252, 0.28);
  background: linear-gradient(135deg, rgba(2, 6, 23, 0.75), rgba(15, 23, 42, 0.6));
  padding: 1rem;
  overflow: hidden;
}

.service-slide {
  display: none;
  min-height: 130px;
}

.service-slide.active {
  display: block;
  animation: revealIn 560ms cubic-bezier(0.2, 0.65, 0.18, 1) forwards;
}

.service-slide-title {
  margin-top: 0.55rem;
  color: #e2e8f0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.service-slide-text {
  margin-top: 0.55rem;
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.6;
}

.service-slide-meta {
  margin-top: 0.8rem;
  display: inline-flex;
  border: 1px solid rgba(125, 211, 252, 0.4);
  border-radius: 9999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a5f3fc;
}

.service-carousel-dots {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.service-dot {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(30, 41, 59, 0.7);
  transition: transform 170ms ease, background 170ms ease, border-color 170ms ease;
}

.service-dot.active {
  border-color: rgba(34, 211, 238, 0.82);
  background: rgba(34, 211, 238, 0.85);
  transform: scale(1.16);
}

.service-carousel-nav {
  margin-top: 0.7rem;
  display: flex;
  gap: 0.5rem;
}

.service-carousel-nav button {
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 9999px;
  padding: 0.24rem 0.7rem;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.45);
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.service-carousel-nav button:hover {
  border-color: rgba(125, 211, 252, 0.7);
  color: #e2e8f0;
  background: rgba(2, 6, 23, 0.75);
}

.theme-toggle-input:checked + .theme-toggle-track {
  background: rgba(59, 130, 246, 0.45);
  border-color: rgba(59, 130, 246, 0.75);
}

.theme-toggle-input:checked + .theme-toggle-track::after {
  transform: translateX(1.1rem);
  background: #eff6ff;
}

.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 4%, rgba(56, 189, 248, 0.58), transparent 39%),
    radial-gradient(circle at 36% 2%, rgba(112, 140, 255, 0.55), transparent 41%),
    radial-gradient(circle at 78% 5%, rgba(251, 191, 36, 0.34), transparent 35%),
    radial-gradient(circle at 88% 72%, rgba(34, 211, 238, 0.39), transparent 41%),
    radial-gradient(circle at 46% 92%, rgba(163, 230, 53, 0.24), transparent 41%),
    linear-gradient(120deg, #1b2b48 0%, #2a4167 52%, #3a557d 100%);
  animation: bgShift 18s ease-in-out infinite alternate;
}

.site-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(148, 163, 184, 0.06) 0,
      rgba(148, 163, 184, 0.06) 1px,
      transparent 1px,
      transparent 72px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(148, 163, 184, 0.045) 0,
      rgba(148, 163, 184, 0.045) 1px,
      transparent 1px,
      transparent 72px
    );
  opacity: 0.35;
  animation: gridDrift 22s linear infinite;
}

.site-bg::after {
  content: none;
}

.site-top-accent {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to right, transparent, rgba(169, 191, 255, 0.85), transparent);
  animation: topScan 5.5s linear infinite;
}

header nav a {
  position: relative;
  transition: color 200ms ease;
}

header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.9), transparent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 220ms ease;
}

header nav a:hover::after {
  transform: scaleX(1);
}

main [class*="rounded-xl"],
main [class*="rounded-2xl"] {
  position: relative;
  overflow: hidden;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

main [class*="rounded-xl"]::before,
main [class*="rounded-2xl"]::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(125, 211, 252, 0.08) 40%,
    rgba(148, 163, 184, 0.14) 50%,
    rgba(165, 243, 252, 0.08) 60%,
    transparent 80%
  );
  transform: translateX(-140%);
  pointer-events: none;
}

main [class*="rounded-xl"]:hover::before,
main [class*="rounded-2xl"]:hover::before {
  animation: sheenSweep 950ms ease;
}

main [class*="rounded-xl"]:hover,
main [class*="rounded-2xl"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.36);
}

.motion-reveal {
  opacity: 0;
  transform: translateY(14px);
}

.motion-reveal.is-visible {
  animation: revealIn 700ms cubic-bezier(0.2, 0.65, 0.18, 1) forwards;
}

.fx-tilt {
  transform-style: preserve-3d;
  will-change: transform;
}

.fx-float {
  animation: softFloat 5.8s ease-in-out infinite;
}

@keyframes bgShift {
  0% { filter: saturate(1) brightness(1); }
  100% { filter: saturate(1.08) brightness(1.05); }
}

@keyframes gridDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(18px, 10px, 0); }
}

@keyframes orbitalFloat {
  0%, 100% { transform: rotate(-12deg) translateY(0); }
  50% { transform: rotate(-7deg) translateY(-8px); }
}

@keyframes topScan {
  0% { opacity: 0.2; transform: translateX(-35%); }
  50% { opacity: 0.95; }
  100% { opacity: 0.2; transform: translateX(35%); }
}

@keyframes sheenSweep {
  to { transform: translateX(140%); }
}

@keyframes revealIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes softFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

html.theme-light .theme-toggle {
  color: #0f172a;
}

html.theme-light .theme-toggle-label {
  color: #0f172a;
}

html.theme-light .theme-toggle-track {
  background: rgba(226, 232, 240, 0.95);
  border-color: rgba(100, 116, 139, 0.45);
}

html.theme-light .frontier-avatar {
  filter: brightness(0.9) saturate(0.92);
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.16);
}

html.theme-light .service-carousel {
  border-color: rgba(148, 163, 184, 0.42);
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.88), rgba(241, 245, 249, 0.85));
}

html.theme-light .service-slide-title {
  color: #0f172a;
}

html.theme-light .service-slide-text {
  color: #334155;
}

html.theme-light .service-slide-meta {
  border-color: rgba(59, 130, 246, 0.46);
  color: #1d4ed8;
}

html.theme-light .service-dot {
  background: rgba(226, 232, 240, 0.9);
  border-color: rgba(100, 116, 139, 0.4);
}

html.theme-light .service-dot.active {
  border-color: rgba(59, 130, 246, 0.8);
  background: rgba(59, 130, 246, 0.8);
}

html.theme-light .service-carousel-nav button {
  background: rgba(248, 250, 252, 0.92);
  color: #334155;
  border-color: rgba(100, 116, 139, 0.42);
}

html.theme-light .site-logo {
  filter: brightness(0.6) saturate(0.75) contrast(1.08);
  opacity: 0.86;
}

html.theme-light .site-bg {
  background:
    radial-gradient(circle at 12% 4%, rgba(56, 189, 248, 0.28), transparent 39%),
    radial-gradient(circle at 36% 2%, rgba(112, 140, 255, 0.26), transparent 41%),
    radial-gradient(circle at 78% 5%, rgba(251, 191, 36, 0.22), transparent 35%),
    radial-gradient(circle at 88% 72%, rgba(34, 211, 238, 0.24), transparent 41%),
    radial-gradient(circle at 46% 92%, rgba(163, 230, 53, 0.16), transparent 41%),
    linear-gradient(120deg, #edf4ff 0%, #e1ebff 52%, #d8e5fb 100%);
}

html.theme-light .site-bg::before {
  opacity: 0.22;
}

html.theme-light .site-bg::after {
  content: none;
}

html.theme-light .site-top-accent {
  background: linear-gradient(to right, transparent, rgba(59, 130, 246, 0.45), transparent);
}

html.theme-light body {
  color: #0f172a !important;
}

html.theme-light header,
html.theme-light footer {
  background: rgba(255, 255, 255, 0.72) !important;
  border-color: rgba(148, 163, 184, 0.45) !important;
}

html.theme-light main [class*="bg-slate-9"],
html.theme-light main [class*="bg-slate-8"],
html.theme-light main [class*="bg-slate-95"],
html.theme-light main [class*="from-slate-9"],
html.theme-light main [class*="via-slate-9"],
html.theme-light main [class*="bg-brand-500/10"],
html.theme-light main [class*="bg-rose-500/10"],
html.theme-light main [class*="to-cyan-900"],
html.theme-light main [class*="to-brand-900"],
html.theme-light main [class*="to-lime-900"],
html.theme-light main [class*="to-indigo-900"],
html.theme-light main [class*="to-teal-900"],
html.theme-light main [class*="to-amber-900"] {
  background: rgba(255, 255, 255, 0.72) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  box-shadow: none !important;
}

html.theme-light main [class*="bg-gradient-to-"] {
  background-image: none !important;
}

html.theme-light input,
html.theme-light textarea,
html.theme-light select {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(148, 163, 184, 0.55) !important;
  color: #0f172a !important;
}

html.theme-light input::placeholder,
html.theme-light textarea::placeholder {
  color: #64748b !important;
}

html.theme-light .prose-custom h1,
html.theme-light .prose-custom h2,
html.theme-light .prose-custom h3 {
  color: #0f172a !important;
}

html.theme-light .prose-custom p,
html.theme-light .prose-custom ul,
html.theme-light .prose-custom ol,
html.theme-light .prose-custom li {
  color: #334155 !important;
}

html.theme-light .prose-custom code {
  background: rgba(148, 163, 184, 0.18) !important;
  color: #1d4ed8 !important;
}

html.theme-light .prose-custom pre {
  background: rgba(248, 250, 252, 0.95) !important;
  border-color: rgba(148, 163, 184, 0.45) !important;
}

html.theme-light .prose-custom a {
  color: #1d4ed8 !important;
}

html.theme-light .text-slate-100,
html.theme-light .text-slate-200,
html.theme-light .text-slate-300,
html.theme-light .text-slate-400,
html.theme-light .text-white {
  color: #1e293b !important;
}

html.theme-light .text-cyan-300,
html.theme-light .text-lime-300,
html.theme-light .text-amber-300,
html.theme-light .text-rose-300,
html.theme-light .text-brand-300,
html.theme-light .text-brand-200,
html.theme-light .text-cyan-200,
html.theme-light .text-lime-200 {
  color: #1d4ed8 !important;
}

@media (prefers-reduced-motion: reduce) {
  .site-bg,
  .site-bg::before,
  .site-bg::after,
  .site-top-accent,
  .fx-float,
  .motion-reveal.is-visible {
    animation: none !important;
  }

  main [class*="rounded-xl"]::before,
  main [class*="rounded-2xl"]::before {
    animation: none !important;
  }
}
