/* ═══════════════════════════════════════════
   Abraham Sencion — Digital Art Installation
   ═══════════════════════════════════════════ */

/* Reset & base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  width: 100%;
  height: 100vh;
  background: #000;
  overflow: hidden;
  cursor: none;
  touch-action: none;
  position: relative;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Custom cursor ── */
.cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transition: width 0.3s ease, height 0.3s ease, background 0.3s ease;
  mix-blend-mode: difference;
}
.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transition: width 0.5s ease, height 0.5s ease, opacity 0.3s ease;
}
.cursor.hover-orb {
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.5);
}
.cursor-glow.hover-orb {
  width: 60px;
  height: 60px;
}

/* Hide custom cursor on touch devices */
@media (hover: none) {
  .cursor, .cursor-glow { display: none; }
  html, body { cursor: default; }
}

/* ── Vignette ── */
.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%);
  z-index: 2;
  pointer-events: none;
}

/* ── Stars ── */
.stars {
  position: fixed;
  inset: 0;
  z-index: 1;
  transform-origin: center;
}

.twinkle {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0;
  animation: fadeIn 3s ease-out forwards, twinkle 6s infinite ease-in-out;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

/* ── Warp canvas ── */
#warpCanvas {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: none;
  opacity: 0;
  transition: opacity 800ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* ── Star warp states ──
   All streaking is handled by the canvas for smooth GPU performance.
   DOM stars simply fade out gracefully during warp. */
.stars.warp-fade {
  opacity: 0;
  transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
}
.stars.hide {
  opacity: 0;
  transition: opacity 2.5s ease-in-out;
}

/* ── Respect reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .twinkle { animation: none !important; opacity: 0.7 !important; }
  .orb, .orb::after { animation: none !important; }
  .cursor, .cursor-glow { transition: none !important; }
}

/* ── Star keyframes ── */
@keyframes fadeIn {
  to { opacity: 1; }
}
@keyframes twinkle {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
}

/* ── Orb ── */
.orb-wrapper {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  animation: orbHueShift 25s linear infinite;
}

.orb {
  width: min(48vw, 280px);
  height: min(48vw, 280px);
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 35%,
    hsl(280, 80%, 20%) 0%,
    hsl(260, 90%, 25%) 25%,
    hsl(230, 100%, 40%) 50%,
    hsl(200, 80%, 55%) 70%,
    hsl(170, 60%, 65%) 85%,
    hsl(50, 70%, 80%) 100%
  );
  animation:
    morph 18s ease-in-out infinite,
    orbBreathe 8s ease-in-out infinite;
  filter: blur(0.8px) saturate(1.4) brightness(0.95);
  box-shadow:
    0 0 60px 20px rgba(100, 100, 255, 0.08),
    0 0 120px 60px rgba(100, 100, 255, 0.05),
    inset 0 0 60px 10px rgba(0, 0, 0, 0.3);
  transition: filter 0.8s ease, box-shadow 0.8s ease;
  position: relative;
  z-index: 4;
}

.orb::after {
  content: '';
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(120, 120, 255, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  animation: pulse 4s ease-in-out infinite;
  pointer-events: none;
}

/* Orb hover proximity glow — toggled via JS */
.orb.near {
  filter: blur(0.5px) saturate(1.6) brightness(1.1);
  box-shadow:
    0 0 80px 30px rgba(140, 120, 255, 0.15),
    0 0 160px 80px rgba(100, 100, 255, 0.08),
    inset 0 0 60px 10px rgba(0, 0, 0, 0.2);
}

@media (max-width: 600px) {
  .orb {
    width: min(65vw, 260px);
    height: min(65vw, 260px);
    filter: blur(0.6px) saturate(1.3) brightness(0.95);
    box-shadow:
      0 0 40px 15px rgba(100, 100, 255, 0.06),
      0 0 80px 40px rgba(100, 100, 255, 0.04),
      inset 0 0 40px 8px rgba(0, 0, 0, 0.3);
  }
}

@keyframes orbHueShift {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}
@keyframes morph {
  0%, 100% { border-radius: 50%; }
  25% { border-radius: 51% 49% 52% 48%; }
  50% { border-radius: 49% 51% 48% 52%; }
  75% { border-radius: 52% 48% 51% 49%; }
}
@keyframes orbBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.15; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* ── Orb transform effects ── */
.orb.implode {
  animation: implode 1.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.orb.zoom {
  animation: zoomIn 3.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes implode {
  0% { transform: scale(1); opacity: 1; filter: blur(0.8px) saturate(1.4) brightness(0.95); }
  40% { transform: scale(0.6); opacity: 1; filter: blur(0.5px) saturate(1.6) brightness(1.2); }
  70% { transform: scale(0.15); opacity: 0.9; filter: blur(0.3px) saturate(2) brightness(1.6); }
  100% { transform: scale(0.05); opacity: 0.8; filter: blur(0px) saturate(2.2) brightness(2); }
}
@keyframes zoomIn {
  0% { transform: scale(0.05); opacity: 0.8; filter: brightness(2) saturate(2); }
  8% { transform: scale(0.08); opacity: 0.9; filter: brightness(2.5) saturate(1.8); }
  25% { transform: scale(0.8); opacity: 0.7; filter: brightness(1.8) saturate(1.5); }
  50% { transform: scale(8); opacity: 0.4; filter: brightness(1.2) saturate(1.3) blur(2px); }
  75% { transform: scale(40); opacity: 0.15; filter: brightness(1) saturate(1.2) blur(6px); }
  100% { transform: scale(120); opacity: 0; filter: brightness(1) saturate(1) blur(12px); }
}

/* ── Hint text ── */
.hint {
  position: fixed;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  opacity: 0;
  animation: hintFadeIn 2s ease-out 3s forwards;
}
.hint-text {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  user-select: none;
}
.hint.hidden {
  opacity: 0 !important;
  transition: opacity 0.8s ease;
}
@keyframes hintFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Identity overlay ── */
.identity {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-align: center;
  opacity: 0;
  animation: identityFadeIn 2.5s ease-out 1.5s forwards;
  pointer-events: none;
}
.identity-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  font-size: clamp(12px, 1.6vw, 16px);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
  transition: color 1.5s ease, letter-spacing 1.5s ease;
}
/* After warp, name becomes more visible */
.identity.revealed .identity-name {
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.5em;
}
@keyframes identityFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Lightfield ── */
.lightfield {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    circle at center,
    hsl(260, 80%, 12%) 0%,
    hsl(250, 90%, 22%) 25%,
    hsl(220, 100%, 40%) 50%,
    hsl(180, 80%, 55%) 75%,
    hsl(140, 60%, 75%) 100%
  );
  filter: blur(30px) saturate(1.2);
  animation: lightfieldHue 25s linear infinite;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 3s ease-in-out;
}
.lightfield.active {
  opacity: 1;
}
/* Mouse-reactive gradient origin set via JS custom property */
.lightfield.interactive {
  transition: none;
  background: radial-gradient(
    circle at var(--gx, 50%) var(--gy, 50%),
    hsl(260, 80%, 12%) 0%,
    hsl(250, 90%, 22%) 25%,
    hsl(220, 100%, 40%) 50%,
    hsl(180, 80%, 55%) 75%,
    hsl(140, 60%, 75%) 100%
  );
}
@keyframes lightfieldHue {
  0% { filter: hue-rotate(0deg) blur(30px) saturate(1.2); }
  100% { filter: hue-rotate(360deg) blur(30px) saturate(1.2); }
}

@media (max-width: 600px) {
  .lightfield { filter: blur(20px) saturate(1.15); }
}

/* ── Info panel (post-warp) ── */
.info-panel {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
}
.info-panel.visible {
  opacity: 1;
  pointer-events: auto;
}
.info-inner {
  text-align: center;
}
/* ── Roles (post-warp triptych with focus reveal) ── */
.roles {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(20px, 4vw, 56px);
  margin-bottom: 32px;
}
.role {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  cursor: none;
  opacity: 0.32;
  transition: opacity 0.6s ease;
}
.role.active,
.role:hover,
.role:focus-visible {
  opacity: 1;
  outline: none;
}
.role-index {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.6s ease;
}
.role.active .role-index,
.role:hover .role-index {
  color: rgba(255, 255, 255, 0.75);
}
.role-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  font-size: clamp(13px, 1.5vw, 17px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  white-space: nowrap;
  padding-bottom: 6px;
}
.role-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.6);
  transform: translateX(-50%);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.role.active .role-title::after,
.role:hover .role-title::after {
  width: 100%;
}
.role-sep {
  align-self: center;
  width: 1px;
  height: 26px;
  margin-top: 14px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.18),
    transparent
  );
}

@media (hover: none) {
  .role { cursor: default; }
}

@media (max-width: 600px) {
  .roles {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin-bottom: 36px;
  }
  .role {
    flex-direction: row;
    gap: 14px;
    align-items: baseline;
  }
  .role-sep {
    width: 28px;
    height: 1px;
    margin-top: 0;
    background: linear-gradient(
      to right,
      transparent,
      rgba(255, 255, 255, 0.18),
      transparent
    );
  }
}

/* ── Bio reading overlay ── */
.bio-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.bio-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.bio-modal {
  position: relative;
  width: min(92vw, 660px);
  max-height: 82vh;
  transform: translateY(24px);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.bio-overlay.open .bio-modal {
  transform: translateY(0);
}
.bio-close {
  position: absolute;
  top: -42px;
  right: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  font-size: 26px;
  line-height: 1;
  cursor: none;
  padding: 4px 8px;
  transition: color 0.3s ease;
  z-index: 2;
}
.bio-close:hover {
  color: rgba(255, 255, 255, 0.8);
}
.bio-scroll {
  max-height: 82vh;
  overflow-y: auto;
  padding: 4px 4px 8px;
  /* fade top & bottom edges as content scrolls under */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.bio-scroll::-webkit-scrollbar {
  width: 6px;
}
.bio-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
.bio-article {
  display: none;
  padding: 8px 4px 16px;
}
.bio-article.active {
  display: block;
}
.bio-index {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.35em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 10px;
}
.bio-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  font-size: clamp(20px, 3.2vw, 30px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 28px;
}
.bio-article p:not(.bio-index) {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: 1.75;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.6);
  max-width: 60ch;
  margin-bottom: 18px;
}
.bio-article p:not(.bio-index):last-child {
  margin-bottom: 0;
}
@media (hover: none) {
  .bio-close { cursor: default; }
}
@media (max-width: 600px) {
  .bio-modal { max-height: 86vh; }
  .bio-scroll { max-height: 86vh; }
  .bio-title { margin-bottom: 22px; }
}
.info-links {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 48px;
}
.info-link {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: none;
  transition: color 0.4s ease;
  position: relative;
}
.info-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.4);
  transition: width 0.4s ease;
}
.info-link:hover {
  color: rgba(255, 255, 255, 0.8);
}
.info-link:hover::after {
  width: 100%;
}
.info-hint-keys {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.15);
  text-transform: uppercase;
}
@media (max-width: 600px) {
  .info-hint-keys {
    display: none;
  }
}
.info-hint-keys kbd {
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: inherit;
  margin-right: 4px;
}

/* ── Sound toggle ── */
.sound-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 20;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  padding: 0;
  transition: border-color 0.4s ease;
}
.sound-toggle:hover {
  border-color: rgba(255, 255, 255, 0.3);
}
.sound-icon {
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.4s ease;
  pointer-events: none;
}
.sound-toggle:hover .sound-icon {
  color: rgba(255, 255, 255, 0.6);
}

@media (hover: none) {
  .sound-toggle { cursor: default; }
}

/* ── Contact modal ── */
.contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.contact-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.contact-modal {
  width: min(90vw, 420px);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.contact-overlay.open .contact-modal {
  transform: translateY(0);
}

.contact-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-size: 24px;
  cursor: none;
  padding: 4px 8px;
  transition: color 0.3s ease;
  line-height: 1;
}
.contact-close:hover {
  color: rgba(255, 255, 255, 0.7);
}

.contact-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  font-size: clamp(16px, 2.5vw, 22px);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 32px;
  text-align: center;
}

.contact-field {
  margin-bottom: 20px;
}
.contact-field label {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 8px;
}
.contact-field input,
.contact-field textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 12px 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.8);
  outline: none;
  transition: border-color 0.3s ease, background 0.3s ease;
  cursor: none;
}
.contact-field input:focus,
.contact-field textarea:focus {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
}
.contact-field textarea {
  resize: vertical;
  min-height: 100px;
}
.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.15);
}

.contact-submit {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  cursor: none;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.contact-submit:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}
.contact-submit:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.contact-status {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-align: center;
  margin-top: 16px;
  min-height: 20px;
  color: rgba(255, 255, 255, 0.4);
}

@media (hover: none) {
  .contact-close,
  .contact-field input,
  .contact-field textarea,
  .contact-submit { cursor: default; }
}

/* ── Synth hint (bottom-left, mirrors sound toggle bottom-right) ── */
.synth-hint {
  position: fixed;
  bottom: 34px;
  left: 28px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
.synth-hint.visible {
  opacity: 1;
}
.synth-hint-text {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
}
@media (max-width: 600px) {
  .synth-hint {
    bottom: 72px;
  }
}
