/* ── jCloud Design System ───────────────────────────────────────────────── */

:root {
  --jc-primary:    #5A8878;
  --jc-tint:       #7AAA98;
  --jc-muted:      #6A8A80;
  --jc-mauve:      #9888A8;
  --jc-font:       'Helvetica Neue', Helvetica, Arial, sans-serif;
  --jc-mono:       'Courier New', Courier, monospace;
  --jc-main-top:   #9FC1B5;
  --jc-main-front: #8EB3A5;
  --jc-main-side:  #7AAA98;
  --jc-mini-top:   #C5D9D1;
  --jc-mini-front: #9FC1B5;
  --jc-mini-side:  #8EB3A5;
}

/* ── Base background ─────────────────────────────────────────────────────── */
body, #page_wrapper {
  background:
    radial-gradient(ellipse 70% 55% at 0% 0%,   rgba(90,136,120,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 55% 45% at 100% 100%, rgba(152,136,168,0.13) 0%, transparent 70%),
    #0A1410 !important;
  min-height: 100vh;
}

html:not(.dark) body,
html:not(.dark) #page_wrapper {
  background:
    radial-gradient(ellipse 70% 55% at 0% 0%,   rgba(90,136,120,0.22) 0%, transparent 70%),
    radial-gradient(ellipse 55% 45% at 100% 100%, rgba(152,136,168,0.17) 0%, transparent 70%),
    #EEF4F1 !important;
}

/* ── Animated background blobs ───────────────────────────────────────────── */
#jc-blob-1, #jc-blob-2 {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(100px);
  z-index: 0;
}

#jc-blob-1 {
  width: 65vw; height: 65vw;
  top: -15vw; left: -15vw;
  background: rgba(90, 136, 120, 0.18);
  animation: blobDrift1 22s ease-in-out infinite;
}

#jc-blob-2 {
  width: 55vw; height: 55vw;
  bottom: -12vw; right: -12vw;
  background: rgba(152, 136, 168, 0.14);
  animation: blobDrift2 28s ease-in-out infinite alternate;
}

html:not(.dark) #jc-blob-1 { background: rgba(90, 136, 120, 0.22); }
html:not(.dark) #jc-blob-2 { background: rgba(152, 136, 168, 0.17); }

@keyframes blobDrift1 {
  0%, 100% { transform: translate(0, 0)      scale(1); }
  33%       { transform: translate(5vw, 4vw)  scale(1.07); }
  66%       { transform: translate(-3vw, 7vw) scale(0.93); }
}

@keyframes blobDrift2 {
  0%   { transform: translate(0, 0)       scale(1); }
  100% { transform: translate(-6vw, -5vw) scale(1.10); }
}

/* ── Shared cube keyframes ───────────────────────────────────────────────── */

@keyframes bounce {
  20%  { transform: rotateX(35deg) rotateZ(45deg) translateZ(-5em); }
  50%  { transform: rotateX(47deg) rotateZ(45deg) translateZ(-4em); }
  100% { transform: rotateX(45deg) rotateZ(45deg) translateZ(-4em); }
}

@keyframes cubeMini {
  0%    { transform: translateZ(9.4em) translateX(0)      translateY(0)      rotateY(0) rotateX(0); }
  5.5%  { transform: translateZ(9.4em) translateX(-2.8em) translateY(0)      rotateY(-90deg); }
  11%   { transform: translateZ(9.4em) translateX(-5.6em) translateY(0)      rotateY(-180deg); }
  16.5% { transform: translateZ(9.4em) translateX(-5.6em) translateY(2.8em)  rotateY(-180deg) rotateX(90deg); }
  22%   { transform: translateZ(9.4em) translateX(-5.6em) translateY(5.6em)  rotateY(-180deg) rotateX(180deg); }
  27.5% { transform: translateZ(6.6em) translateX(-5.6em) translateY(8.4em)  rotateY(-180deg) rotateX(270deg); }
  33%   { transform: translateZ(3.8em) translateX(-5.6em) translateY(8.4em)  rotateY(-180deg) rotateX(360deg); }
  38.5% { transform: translateZ(1.0em) translateX(-5.6em) translateY(8.4em)  rotateY(-180deg) rotateX(450deg); }
  44%   { transform: translateZ(1.0em) translateX(-2.8em) translateY(8.4em)  rotateY(-180deg) rotateX(450deg) rotateZ(90deg); }
  49.5% { transform: translateZ(1.0em) translateX(0)      translateY(8.4em)  rotateY(-180deg) rotateX(450deg) rotateZ(180deg); }
  55%   { transform: translateZ(1.0em) translateX(2.8em)  translateY(5.6em)  rotateY(-180deg) rotateX(450deg) rotateZ(270deg); }
  60.5% { transform: translateZ(1.0em) translateX(2.8em)  translateY(2.8em)  rotateY(-180deg) rotateX(450deg) rotateZ(360deg); }
  66%   { transform: translateZ(1.0em) translateX(2.4em)  translateY(0)      rotateY(-180deg) rotateX(450deg) rotateZ(450deg); }
  71.5% { transform: translateZ(3.8em) translateX(2.4em)  translateY(0)      rotateY(-180deg) rotateX(360deg) rotateZ(450deg); }
  77%   { transform: translateZ(6.6em) translateX(2.4em)  translateY(0)      rotateY(-180deg) rotateX(270deg) rotateZ(450deg); }
  82.5% { transform: translateZ(6.6em) translateX(2.4em)  translateY(2.8em)  rotateY(-180deg) rotateX(270deg) rotateZ(360deg); }
  88%   { transform: translateZ(6.6em) translateX(2.4em)  translateY(5.6em)  rotateY(-180deg) rotateX(270deg) rotateZ(270deg); }
  95%   { transform: translateZ(11.4em) translateX(0)     translateY(5.6em)  rotateY(180deg)  rotateX(270deg) rotateZ(270deg); }
  100%  { transform: translateZ(6.6em)  translateX(0)     translateY(5.6em)  rotateY(180deg)  rotateX(270deg) rotateZ(270deg); }
}

@keyframes fadeIn { to { opacity: 1; } }

/* ── Shared cube context ─────────────────────────────────────────────────── */

.jc-cube-ctx {
  transform: scaleX(-1);
  transform-style: preserve-3d;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.jc-cube-ctx .cube {
  position: relative;
  width: 8em; height: 8em;
  transform: rotateX(45deg) rotateZ(45deg) translateZ(-4em);
  transform-style: preserve-3d;
}

.jc-cube-ctx .cube > .face {
  position: absolute;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  backface-visibility: visible;
}

.jc-cube-ctx .cube > .face.top   { transform: translateZ(8em); }
.jc-cube-ctx .cube > .face.left  { transform: rotateX(-90deg) translateZ(4em) translateY(-4em); }
.jc-cube-ctx .cube > .face.right { transform: rotateX(-90deg) rotateY(90deg) translateZ(4em) translateY(-4em); }

.jc-cube-ctx .row { display: flex; margin: 0 0 .3em 0; transform: translateZ(0); }
.jc-cube-ctx .row:last-child { margin: 0; }

.jc-cube-ctx .square {
  height: 2.4em; width: 2.4em;
  margin: 0 .3em 0 0;
  position: relative;
  opacity: 0;
  border-radius: 2px;
}
.jc-cube-ctx .square:last-child { margin: 0; }
.jc-cube-ctx .square[data-index] { animation: fadeIn .16s linear forwards; }

.jc-cube-ctx .cube > .face.top .square[data-index] {
  background: linear-gradient(135deg, var(--jc-main-top), var(--jc-main-front));
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.2), inset -1px -1px 0 rgba(0,0,0,0.05);
}
.jc-cube-ctx .cube > .face.left .square[data-index] {
  background: linear-gradient(135deg, var(--jc-main-front), var(--jc-main-side));
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.1), inset -1px -1px 0 rgba(0,0,0,0.1);
}
.jc-cube-ctx .cube > .face.right .square[data-index] {
  background: linear-gradient(135deg, var(--jc-main-side), var(--jc-main-side));
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.05), inset -1px -1px 0 rgba(0,0,0,0.2);
}

.jc-cube-ctx .square.padding { background: transparent !important; opacity: 1; box-shadow: none; }

.jc-cube-ctx .square[data-index="1"]  { animation-delay: 0.16s; }
.jc-cube-ctx .square[data-index="2"]  { animation-delay: 0.31s; }
.jc-cube-ctx .square[data-index="3"]  { animation-delay: 0.46s; }
.jc-cube-ctx .square[data-index="4"]  { animation-delay: 0.62s; }
.jc-cube-ctx .square[data-index="5"]  { animation-delay: 0.77s; }
.jc-cube-ctx .square[data-index="6"]  { animation-delay: 0.92s; }
.jc-cube-ctx .square[data-index="7"]  { animation-delay: 1.07s; }
.jc-cube-ctx .square[data-index="8"]  { animation-delay: 1.22s; }
.jc-cube-ctx .square[data-index="9"]  { animation-delay: 1.38s; }
.jc-cube-ctx .square[data-index="10"] { animation-delay: 1.69s; }
.jc-cube-ctx .square[data-index="11"] { animation-delay: 1.84s; }
.jc-cube-ctx .square[data-index="12"] { animation-delay: 1.99s; }
.jc-cube-ctx .square[data-index="13"] { animation-delay: 2.30s; }
.jc-cube-ctx .square[data-index="14"] { animation-delay: 2.46s; }
.jc-cube-ctx .square[data-index="15"] { animation-delay: 2.61s; }

.jc-cube-ctx .cube.mini {
  animation: cubeMini 2.8s .16s ease-out forwards;
  width: 2.4em; height: 2.4em;
  position: absolute; right: 0; top: 0;
  transform: translateZ(9.4em);
  transform-style: preserve-3d;
}

.jc-cube-ctx .cube.mini > .face {
  position: absolute; width: 100%; height: 100%;
  border: 1px solid rgba(255,255,255,0.1);
  backface-visibility: visible;
}

.jc-cube-ctx .cube.mini > .face.top    { transform: rotateX(90deg)  translateZ(1.2em); background: linear-gradient(135deg, var(--jc-mini-top), var(--jc-mini-front)); }
.jc-cube-ctx .cube.mini > .face.bottom { transform: rotateX(-90deg) translateZ(1.2em); background: var(--jc-mini-side); }
.jc-cube-ctx .cube.mini > .face.left   { transform: rotateY(-90deg) translateZ(1.2em); background: var(--jc-mini-front); }
.jc-cube-ctx .cube.mini > .face.right  { transform: rotateY(90deg)  translateZ(1.2em); background: var(--jc-mini-front); }
.jc-cube-ctx .cube.mini > .face.front  { transform: translateZ(1.2em); background: linear-gradient(135deg, var(--jc-mini-top), var(--jc-mini-front)); }
.jc-cube-ctx .cube.mini > .face.back   { transform: rotateY(180deg) translateZ(1.2em); background: var(--jc-mini-side); }

/* ── Loader overlay ──────────────────────────────────────────────────────── */

#jc-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background:
    radial-gradient(ellipse 70% 55% at 0% 0%,    rgba(90,136,120,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 55% 45% at 100% 100%, rgba(152,136,168,0.13) 0%, transparent 70%),
    #0A1410;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  animation: loaderFadeOut 0.64s 4.4s ease forwards;
}

html:not(.dark) #jc-loader {
  background:
    radial-gradient(ellipse 70% 55% at 0% 0%,    rgba(90,136,120,0.22) 0%, transparent 70%),
    radial-gradient(ellipse 55% 45% at 100% 100%, rgba(152,136,168,0.17) 0%, transparent 70%),
    #EEF4F1;
}

@keyframes loaderFadeOut {
  to { opacity: 0; pointer-events: none; }
}

#jc-loader .jc-cube-ctx { font-size: 10px; }

/* bounce only on main cube, NOT on mini (fixes specificity bug) */
#jc-loader .cube:not(.mini) { animation: bounce 2.4s 2.8s ease forwards; }

.jc-wordmark {
  /* no transform here — wordmark is sibling of .jc-cube-ctx, not inside it */
  font-size: 3.5em;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  opacity: 0;
  animation: fadeIn 0.64s 3.6s ease forwards;
  letter-spacing: -0.04em;
  margin-top: 0.5em;
  font-family: var(--jc-font);
}
.jc-wordmark .wm-j { color: var(--jc-tint); }
html:not(.dark) .jc-wordmark { color: #1a2e28; }

/* ── Static header logo ──────────────────────────────────────────────────── */

#jc-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  height: 15em;
  margin: 1.5rem auto 0.5rem;
  perspective: 600px;
  overflow: visible;
}

#jc-logo .jc-cube-ctx { font-size: 6px; }

/* All squares immediately visible */
#jc-logo .square { opacity: 1 !important; animation: none !important; }

/* Main cube: no bounce, stays at resting position */
#jc-logo .cube:not(.mini) { animation: none !important; }

/* Mini cube: frozen at final animation position (100% keyframe of cubeMini) */
#jc-logo .cube.mini {
  animation: none !important;
  transform: translateZ(6.6em) translateX(0) translateY(5.6em) rotateY(180deg) rotateX(270deg) rotateZ(270deg);
}

.jc-logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: -0.04em;
  font-family: var(--jc-font);
}
.jc-logo-text .wm-j { color: var(--jc-tint); }
html:not(.dark) .jc-logo-text { color: #1a2e28; }

/* ── Card reveal on load ─────────────────────────────────────────────────── */
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Liquid Glass — Cards (Dark) ─────────────────────────────────────────── */
.service-block {
  position: relative;
  background: rgba(13, 26, 21, 0.52) !important;
  backdrop-filter: blur(20px) saturate(170%) brightness(108%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(170%) brightness(108%) !important;
  border: 1px solid rgba(90, 136, 120, 0.22) !important;
  border-top-color: rgba(122, 170, 152, 0.32) !important;
  border-radius: 14px !important;
  box-shadow:
    0 2px 24px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(122, 170, 152, 0.13) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease !important;
  overflow: hidden !important;
  min-width: 52px !important;
  animation: cardReveal 0.45s ease both;
}

.service-block::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(122, 170, 152, 0.11) 50%,
    transparent 65%
  );
  transform: translateX(-120%);
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}

.service-block:hover::before { animation: shimmerSweep 0.55s ease forwards; }

@keyframes shimmerSweep { to { transform: translateX(220%); } }

.service-block:hover {
  border-color: rgba(90, 136, 120, 0.44) !important;
  border-top-color: rgba(122, 170, 152, 0.52) !important;
  box-shadow:
    0 5px 32px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(122, 170, 152, 0.22) !important;
  transform: translateY(-2px) !important;
}

/* ── Liquid Glass — Cards (Light) ────────────────────────────────────────── */
html:not(.dark) .service-block {
  background: rgba(255, 255, 255, 0.62) !important;
  border-color: rgba(90, 136, 120, 0.18) !important;
  border-top-color: rgba(90, 136, 120, 0.32) !important;
  box-shadow:
    0 2px 18px rgba(90, 136, 120, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
}

html:not(.dark) .service-block::before {
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(90, 136, 120, 0.09) 50%,
    transparent 65%
  );
}

html:not(.dark) .service-block:hover {
  border-color: rgba(90, 136, 120, 0.36) !important;
  box-shadow:
    0 5px 26px rgba(90, 136, 120, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
}

/* ── Info bar separator ──────────────────────────────────────────────────── */
#information-widgets {
  border-bottom-color: rgba(90, 136, 120, 0.2) !important;
  border-bottom-width: 1px !important;
}

/* ── Section headings ────────────────────────────────────────────────────── */
h2 {
  color: var(--jc-primary) !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  font-family: var(--jc-font) !important;
}

/* ── Resource progress bars ──────────────────────────────────────────────── */
.resource-usage > div { background-color: var(--jc-primary) !important; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(90, 136, 120, 0.3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--jc-primary); }

/* ── Toggle button ───────────────────────────────────────────────────────── */
#jc-theme-toggle {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 9999;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  border: 1px solid rgba(90, 136, 120, 0.35);
  background: rgba(14, 26, 22, 0.85);
  color: var(--jc-tint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.15s ease, background 0.15s ease;
}

#jc-theme-toggle.jc-spinning {
  animation: btnSpin 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes btnSpin {
  0%   { transform: rotate(0deg)   scale(1); }
  40%  { transform: rotate(200deg) scale(0.80); }
  100% { transform: rotate(360deg) scale(1); }
}

html:not(.dark) #jc-theme-toggle { background: rgba(244, 247, 245, 0.85); color: var(--jc-primary); }
#jc-theme-toggle:hover { border-color: var(--jc-primary); }
#jc-theme-toggle svg { display: block; flex-shrink: 0; pointer-events: none; }
