/* ══════════════════════════════════════════════════════════
   scene.css — interactive isometric 3D hero (pure CSS 3D).
   A profile card exploded into design layers: canvas →
   wireframe → UI → community. Line-art style: white faces,
   ink outlines, flat royal-blue slab shadows, violet accents.
   ══════════════════════════════════════════════════════════ */

.scene { position: relative; user-select: none; }

.scene__stage {
  position: relative;
  height: 380px;
  perspective: 2400px;
  touch-action: pan-y;
}
@media (min-width: 1024px) { .scene__stage { height: 460px; } }

.scene__float {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  animation: scene-float 6s ease-in-out infinite;
}
@media (max-width: 639px) { .scene__float { transform: scale(0.7); } }
@media (min-width: 1024px) { .scene__float { transform: scale(0.82); } }
@media (min-width: 1440px) { .scene__float { transform: scale(0.92); } }
@media (min-width: 640px) and (max-width: 1023px) { .scene__stage { height: 560px; } }

.iso {
  --rx: 56deg;
  --rz: -40deg;
  --gap: 30px;
  --w: 300px;
  --h: 380px;
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--w);
  height: var(--h);
  margin: calc(var(--h) / -2) 0 0 calc(var(--w) / -2);
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateZ(var(--rz));
  transition: top 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.scene.is-exploded .iso { --gap: 82px; top: 64%; }
@media (max-width: 639px) {
  .scene.is-exploded .iso { --gap: 62px; top: 62%; }
}

/* ── Layers ───────────────────────────────────────────── */
.iso__layer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--i) * var(--gap)));
  transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 300ms ease;
}
.iso__layer:not(.iso__layer--top) {
  background: var(--color-surface);
  border: var(--line);
}
/* Slab: a flat royal-blue copy under each layer = thickness + cast shadow */
.iso__layer:not(.iso__layer--top)::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  background: var(--color-brand);
  border: var(--line);
  transform: translateZ(-14px);
}
.iso__layer--base { background: var(--color-sky-soft) !important; }
.iso__layer--base::after {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: var(--radius-lg);
  background-image: radial-gradient(var(--color-border-strong) 1.2px, transparent 1.3px);
  background-size: 18px 18px;
  opacity: 0.9;
}

/* Focus one layer */
.scene[data-focus] .iso__layer { opacity: 0.18; }
.scene[data-focus="canvas"] [data-layer="canvas"],
.scene[data-focus="wireframe"] [data-layer="wireframe"],
.scene[data-focus="ui"] [data-layer="ui"],
.scene[data-focus="community"] [data-layer="community"] { opacity: 1; }

/* Billboard: stands up and faces the viewer */
.iso__tag,
.cursor,
.iso__tip {
  transform-origin: 50% 100%;
}
.iso__tag {
  position: absolute;
  left: -14px;
  top: 18px;
  padding: 6px 12px;
  border: var(--line);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: 13px;
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-100%) translateZ(2px) rotateZ(calc(var(--rz) * -1)) rotateX(calc(var(--rx) * -1));
  transition: opacity 400ms ease;
  pointer-events: none;
}
.scene.is-exploded .iso__tag,
.scene[data-focus] .iso__tag { opacity: 1; }

/* ── Canvas objects ───────────────────────────────────── */
.iso__swatches { position: absolute; left: -86px; bottom: 40px; width: 64px; height: 64px; transform-style: preserve-3d; z-index: 1; }
.iso__swatch {
  position: absolute;
  inset: 0;
  border: var(--line);
  border-radius: 14px;
}
.iso__swatch--brand { background: var(--color-brand); transform: translateZ(4px); }
.iso__swatch--sky { background: var(--color-sky); transform: translate(10px, -10px) translateZ(14px); }
.iso__swatch--violet { background: var(--color-violet); transform: translate(20px, -20px) translateZ(24px); }

.iso__puck { position: absolute; left: -70px; bottom: 30px; width: 74px; height: 74px; transform-style: preserve-3d; z-index: 1; }
.iso__puck i {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  border: var(--line);
  background: var(--color-surface);
}
.iso__puck i:nth-child(1) { transform: translateZ(2px); background: var(--color-brand); }
.iso__puck i:nth-child(2) { transform: translateZ(8px); }
.iso__puck i:nth-child(3) { transform: translateZ(14px); }
.iso__puck i:nth-child(4) { transform: translateZ(18px) scale(0.78); background: var(--color-violet); }

.iso__pen {
  position: absolute;
  left: 60px;
  top: 300px;
  width: 190px;
  height: 18px;
  border: var(--line);
  border-radius: 4px 9px 9px 4px;
  background: var(--color-surface);
  transform: rotateZ(-28deg) translateZ(10px);
  z-index: 1;
}
.iso__pen::before {
  content: '';
  position: absolute;
  inset: 3px 40px 3px 12px;
  border-top: var(--line);
  opacity: 0.35;
}
.iso__pen-tip {
  position: absolute;
  left: -22px;
  top: -1.5px;
  width: 22px;
  height: 18px;
  background: var(--color-line);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.iso__pen-cap {
  position: absolute;
  right: -8px;
  top: -1.5px;
  width: 22px;
  height: 18px;
  border: var(--line);
  border-radius: 9px;
  background: var(--color-violet);
}

/* ── Wireframe layer ──────────────────────────────────── */
.wf { position: absolute; border: 1.5px dashed var(--color-border-strong); border-radius: 10px; }
.wf--cover { left: 18px; right: 18px; top: 18px; height: 92px; overflow: hidden; }
.wf--cover svg { width: 100%; height: 100%; }
.wf--cover path { stroke: var(--color-border-strong); stroke-width: 0.6; fill: none; vector-effect: non-scaling-stroke; }
.wf--avatar { left: 34px; top: 82px; width: 64px; height: 64px; border-radius: var(--radius-full); background: var(--color-surface); }
.wf--line { left: 34px; height: 12px; border-radius: 6px; background: var(--color-surface-2); border-style: solid; border-color: transparent; }
.wf--w70 { top: 166px; width: 170px; }
.wf--w45 { top: 188px; width: 110px; }
.wf--row { left: 34px; top: 218px; display: flex; gap: 8px; border: 0; }
.wf--row span { width: 58px; height: 22px; border: 1.5px dashed var(--color-border-strong); border-radius: var(--radius-full); }
.wf--btn { left: 34px; right: 34px; bottom: 30px; height: 40px; border-radius: var(--radius-full); }

/* ── UI layer (profile card) ──────────────────────────── */
.ui-card { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.ui-card__cover {
  height: 112px;
  background:
    radial-gradient(circle at 80% 30%, var(--color-sky) 0 28px, transparent 29px),
    var(--color-brand);
  border-bottom: var(--line);
  position: relative;
}
.ui-card__badge {
  position: absolute;
  right: 14px;
  top: 14px;
  padding: 4px 10px;
  border: var(--line);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: 11px;
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}
.ui-card__avatar {
  position: absolute;
  left: 30px;
  top: 78px;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: var(--line);
  border-radius: var(--radius-full);
  background: var(--color-violet);
  color: var(--color-on-violet);
  font-weight: 800;
  font-size: 20px;
}
.ui-card__name { margin: 64px 30px 2px; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--color-text-primary); }
.ui-card__meta { margin: 0 30px 12px; font-size: 12px; color: var(--color-text-muted); }
.ui-card__chips { display: flex; gap: 6px; margin: 0 30px 14px; }
.ui-card__chips span {
  padding: 3px 10px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}
.ui-card__chips span:last-child { background: var(--color-violet-soft); }
.ui-card__socials { display: flex; gap: 6px; margin: 0 30px; }
.ui-card__socials span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-full);
  background: var(--color-sky-soft);
  font-size: 11px;
  font-weight: 800;
  color: var(--color-text-primary);
}
.ui-card__btn {
  position: absolute;
  left: 30px;
  right: 30px;
  bottom: 24px;
  height: 40px;
  display: grid;
  place-items: center;
  border: var(--line);
  border-radius: var(--radius-full);
  background: var(--color-brand);
  color: var(--color-on-brand);
  font-size: 14px;
  font-weight: var(--weight-bold);
  box-shadow: 3px 3px 0 var(--color-line);
}

/* ── Community layer ──────────────────────────────────── */
.iso__tip {
  position: absolute;
  right: -56px;
  top: -10px;
  width: 150px;
  padding: 12px 14px;
  border: var(--line);
  border-radius: 16px;
  background: var(--color-violet-soft);
  box-shadow: 4px 4px 0 var(--color-violet);
  display: grid;
  gap: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--color-text-primary);
  transform: translateZ(6px) rotateZ(calc(var(--rz) * -1)) rotateX(calc(var(--rx) * -1));
}
.iso__tip b { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.iso__tip em { font-style: normal; font-weight: var(--weight-bold); font-size: 11px; color: var(--color-text-secondary); }

.cursor {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 2px;
  --tf: rotateZ(calc(var(--rz) * -1)) rotateX(calc(var(--rx) * -1));
  transform: var(--tf);
  pointer-events: none;
}
.cursor svg { width: 20px; height: 20px; fill: var(--c); stroke: var(--color-line); stroke-width: 1.4; stroke-linejoin: round; }
.cursor span {
  margin-top: 14px;
  padding: 3px 9px;
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-full);
  background: var(--c);
  color: var(--tc);
  font-size: 11px;
  font-weight: var(--weight-bold);
  white-space: nowrap;
}
.cursor--a { --c: var(--color-brand); --tc: var(--color-on-brand); left: 40px; top: 24px; animation: cur-a 9s ease-in-out infinite; }
.cursor--b { --c: var(--color-violet); --tc: var(--color-on-violet); left: 236px; top: 200px; animation: cur-b 10s ease-in-out infinite; }
.cursor--c { --c: var(--color-sky); --tc: var(--color-on-violet); left: 120px; top: 320px; animation: cur-c 9s ease-in-out infinite; }

@keyframes cur-a {
  0%, 100% { left: 40px; top: 24px; }
  50% { left: 150px; top: 44px; }
}
@keyframes cur-b {
  0%, 100% { left: 236px; top: 200px; }
  50% { left: 246px; top: 300px; }
}
@keyframes scene-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

/* ── Hint ─────────────────────────────────────────────── */
.scene__hint {
  margin: 0;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: opacity 300ms ease;
}
.scene.is-exploded .scene__hint { opacity: 0; }
@media (hover: none) { .scene__hint { display: none; } }

/* ── Controls ─────────────────────────────────────────── */
.scene__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.scene__chip {
  padding: 8px 14px;
  border: var(--line);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.scene__chip:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--color-line); }
.scene__chip.is-active { background: var(--color-sky); }
.scene__chip--toggle[aria-pressed="true"] { background: var(--color-ink); color: var(--color-on-ink); }
.scene__chip:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .scene__float, .cursor { animation: none; }
  .iso__layer { transition: opacity 200ms ease; }
}
