/* Darren Tsang — Personal Portfolio Styles */

* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --bg: #060608;
  --panel-bg: rgba(18,16,28,0.97);
  --panel-border: rgba(255,255,255,0.22);
  --panel-shadow: 0 0 60px rgba(0,0,0,0.6);
  --text: rgba(255,255,255,0.98);
  --text-muted: rgba(255,255,255,0.6);
  --text-dim: rgba(255,255,255,0.4);
  --accent-glow: rgba(180,160,255,0.3);
  --backdrop: rgba(0,0,0,0.55);
}
body[data-theme="light"] {
  --bg: #f5f3ef;
  --panel-bg: rgba(255,253,248,0.98);
  --panel-border: rgba(0,0,0,0.12);
  --panel-shadow: 0 0 60px rgba(0,0,0,0.08);
  --text: rgba(20,18,25,0.95);
  --text-muted: rgba(20,18,25,0.65);
  --text-dim: rgba(20,18,25,0.45);
  --accent-glow: rgba(100,80,180,0.15);
  --backdrop: rgba(0,0,0,0.25);
}
html, body { width:100%; height:100%; overflow:hidden; }

body {
  background: var(--bg);
  font-family: 'DM Mono', monospace;
  cursor: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  transition: background 0.5s ease;
}

/* Hide constellations until intro starts dissolving */
body.intro-active #universe,
body.intro-active .const-label,
body.intro-active .const-hit,
body.intro-active #nav-dots,
body.intro-active #instructions,
body.intro-active #themeToggle {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

/* CANVAS */
#universe {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* CURSOR */
#cur {
  position: fixed;
  z-index: 9999;
  pointer-events: none !important;
  width: 6px; height: 6px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  transition: transform .1s, opacity .1s;
  mix-blend-mode: screen;
}
body[data-theme="light"] #cur {
  background: rgba(40,35,60,0.85);
  mix-blend-mode: normal;
}
#cur-aura {
  position: fixed;
  z-index: 9998;
  pointer-events: none !important;
  width: 120px; height: 120px;
  border-radius: 50%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle, rgba(180,160,255,0.06) 0%, transparent 70%);
  transition: width .3s, height .3s;
}
body[data-theme="light"] #cur-aura {
  background: radial-gradient(circle, rgba(100,80,150,0.08) 0%, transparent 70%);
}

/* INTRO */
#intro {
  position: fixed;
  inset: 0; z-index: 8000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.5s ease;
}
#intro.hidden { opacity: 0; pointer-events: none; cursor: default; }
.intro-skip {
  position: absolute;
  bottom: 48px;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color .2s;
}
#intro:hover .intro-skip { color: var(--text-muted); }
.intro-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(48px, 8vw, 96px);
  font-style: italic; font-weight: 300;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1;
  text-align: center;
  opacity: 0;
  animation: fadeIn 1.2s .3s forwards;
}
.intro-sub {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-top: 20px;
  opacity: 0;
  animation: fadeIn .8s 1s forwards;
}

/* CONSTELLATION LABELS */
.const-label {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color .4s, transform .4s, text-shadow .4s;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}
.const-label.visible {
  color: var(--text);
  text-shadow: 0 0 20px var(--accent-glow);
}
body[data-theme="light"] .const-label { color: var(--text-muted); }
body[data-theme="light"] .const-label.visible { color: var(--text); }

/* HIT AREAS */
.const-hit {
  position: fixed;
  z-index: 150;
  width: 160px;
  height: 160px;
  transform: translate(-50%, -50%);
  cursor: pointer;
  border-radius: 50%;
}
@media (max-width: 768px) {
  .const-hit { width: 220px; height: 220px; }
  .panel-inner { min-width: 320px; width: min(100vw - 32px, 720px); }
}

/* PANEL */
#panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 800;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1), transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
#panel.shown {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: all;
  cursor: default;
}
body.panel-open #nav-dots,
body.panel-open #instructions { opacity: 0; pointer-events: none; transition: opacity .3s; }

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 750;
  pointer-events: none;
  background: transparent;
  transition: background .3s;
}
body.panel-open .panel-backdrop {
  pointer-events: all;
  background: var(--backdrop);
  transition: background 0.4s ease;
}

.panel-inner {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow), 0 0 0 1px var(--panel-border);
  backdrop-filter: blur(24px);
  padding: 40px;
  padding-top: 50px;
  width: min(720px, 90vw);
  max-width: 720px;
  min-width: 420px;
  height: 92vh;
  min-height: 520px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--text-dim) transparent;
  user-select: text;
}
.panel-inner::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(200,190,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}
body[data-theme="light"] .panel-inner::before {
  background: linear-gradient(135deg, rgba(100,80,150,0.04) 0%, transparent 60%);
}

.panel-inner::after {
  content: '';
  position: absolute; inset: -1px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(180,160,255,0.2), rgba(100,180,255,0.1), transparent) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .6s;
  pointer-events: none;
}
#panel.shown .panel-inner::after { opacity: 1; }

.panel-tag {
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
}
.panel-tag-dot { width: 4px; height: 4px; border-radius: 50%; }

.panel-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.1; letter-spacing: -.01em;
  color: var(--text);
  margin-bottom: 20px;
}

.panel-body {
  font-size: 13px; line-height: 1.8;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 24px;
}
.panel-body strong { color: var(--text); font-weight: 500; }
.panel-body p + p { margin-top: 12px; }
.panel-section-head {
  font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim); margin-top: 20px; margin-bottom: 8px;
}
.panel-section-head:first-of-type { margin-top: 0; }

/* panel items */
.panel-items { display: flex; flex-direction: column; gap: 0; }
.panel-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: grid; grid-template-columns: 20px 1fr;
  gap: 12px; align-items: start;
  font-size: 12px; color: var(--text-muted);
  line-height: 1.6; font-weight: 300;
  cursor: none;
  transition: color .15s;
}
body[data-theme="light"] .panel-item { border-color: rgba(0,0,0,0.06); }
.panel-item:last-child { border-bottom: none; }
.panel-item:hover { color: var(--text); }
.panel-item strong { color: var(--text); font-weight: 500; }
.pi-num { font-size: 9px; color: var(--text-dim); padding-top: 2px; }

/* tags */
.panel-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.ptag {
  padding: 4px 10px;
  font-size: 10px; letter-spacing: .06em;
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text-muted);
}
body[data-theme="light"] .ptag { border-color: rgba(0,0,0,0.2); }
.ptag.hi { border-color: rgba(180,160,255,0.3); color: rgba(180,160,255,0.8); }

/* work timeline */
.work-company { font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.work-company a {
  color: inherit; text-decoration: none;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity .2s;
}
.work-company a:hover { opacity: 1; }
.work-company-duration { font-size: 10px; color: var(--text-dim); letter-spacing: .04em; margin-bottom: 12px; }
.work-roles { display: flex; flex-direction: column; gap: 0; }
.work-role { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 12px; }
body[data-theme="light"] .work-role { border-color: rgba(0,0,0,0.08); }
.work-role:last-child { border-bottom: none; }
.work-role-title { color: var(--text-muted); font-weight: 500; margin-bottom: 2px; }
.work-role-meta { font-size: 10px; color: var(--text-dim); }
.work-role-detail { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.work-entry { margin-bottom: 20px; }
.work-entry:last-child { margin-bottom: 0; }

/* sub-panels */
.panel-with-sub { display: flex; gap: 32px; margin-top: 8px; flex: 1; min-height: 0; }
.panel-sub-nav {
  flex-shrink: 0;
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid rgba(255,255,255,0.08);
  padding-right: 24px;
}
.sub-nav-item {
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: color .2s, background .2s;
  text-align: left;
  border: none;
  background: transparent;
  font-family: inherit;
}
.sub-nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.sub-nav-item.active {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border-left: 2px solid var(--accent, rgba(255,255,255,0.7));
  margin-left: -2px;
  padding-left: 14px;
}
.panel-sub-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel-sub-pane { display: none; flex: 1; min-height: 0; }
.panel-sub-pane.active {
  display: flex;
  flex-direction: column;
  animation: paneFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes paneFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-sub-pane-content { padding-top: 4px; flex: 1; }

/* project */
.project-meta { font-size: 11px; color: var(--text-dim); margin-bottom: 12px; }
.project-stat { font-size: 11px; color: rgba(255,180,100,0.85); }
body[data-theme="light"] .project-stat { color: rgba(180,120,40,0.9); }

/* contact */
.c-links { display: flex; flex-direction: column; gap: 6px; }
.c-link {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  text-decoration: none; cursor: none;
  transition: all .2s;
  color: var(--text-muted);
  font-size: 12px;
}
.c-link:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.c-icon { font-size: 14px; width: 18px; }
.c-lbl { flex: 1; font-weight: 500; color: var(--text); font-size: 11px; }
.c-val { font-size: 10px; color: var(--text-dim); }
.contact-current { border-top: 1px solid rgba(255,255,255,0.06); padding-top: 20px; }
body[data-theme="light"] .contact-current { border-color: rgba(0,0,0,0.08); }
.contact-current-label { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.contact-current-dot { width: 5px; height: 5px; border-radius: 50%; background: #4ade80; animation: blink 2s infinite; display: inline-block; }
.contact-current-rows { display: flex; flex-direction: column; gap: 6px; }
.contact-current-row { display: flex; gap: 12px; font-size: 11px; }
.contact-current-key { color: var(--text-dim); width: 80px; flex-shrink: 0; }
.contact-current-val { color: var(--text-muted); }

/* changelog */
.cl-version-header {
  font-family: 'DM Mono', monospace;
  font-size: 32px; font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
}
.cl-version-desc {
  font-size: 13px; line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.cl-version-meta {
  font-size: 10px; letter-spacing: .06em;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.cl-section-label {
  font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  padding: 6px 12px; margin-bottom: 12px; display: inline-block;
  font-weight: 500; color: #fff;
}
.cl-section-label.added { background: rgba(34,197,94,0.6); }
.cl-section-label.changed { background: rgba(234,179,8,0.5); }
.cl-section-label.removed { background: rgba(239,68,68,0.5); }
.cl-section-label.fixed { background: rgba(59,130,246,0.5); }
.cl-section-list { margin-bottom: 20px; }
.cl-section-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 12px; color: var(--text-muted);
  line-height: 1.6; font-weight: 300;
}
body[data-theme="light"] .cl-section-item { border-color: rgba(0,0,0,0.08); }
.cl-section-item::before {
  content: '';
  width: 6px; height: 6px; min-width: 6px;
  border-radius: 50%;
  margin-top: 6px;
}
.cl-section-list.added .cl-section-item::before { background: #4ade80; }
.cl-section-list.changed .cl-section-item::before { background: #fbbf24; }
.cl-section-list.removed .cl-section-item::before { background: #f87171; }
.cl-section-list.fixed .cl-section-item::before { background: #93c5fd; }
.cl-section-item:last-child { border-bottom: none; }

/* NAV DOTS */
#nav-dots {
  position: fixed;
  bottom: 36px; left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex; gap: 24px;
  align-items: center;
  opacity: 1;
  transition: opacity 1s ease;
}
.ndot {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: none;
  transition: opacity .2s, transform .2s;
  opacity: .65;
}
.ndot:hover { opacity: 1; transform: scale(1.08); }
.ndot-ring {
  width: 10px; height: 10px;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  transition: all .2s;
  position: relative;
}
.ndot.active .ndot-ring {
  background: var(--text);
  border-color: var(--text);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scale(1.2);
}
.ndot-label {
  font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color .2s;
}
.ndot:hover .ndot-label { color: var(--text); }
.ndot.active .ndot-label { color: var(--text); }
.ndot:focus-visible {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: 4px;
  opacity: 1;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes breathe {
  0%,100% { transform: translate(-50%,-50%) scale(1); opacity: .6; }
  50% { transform: translate(-50%,-50%) scale(1.08); opacity: .3; }
}

/* INSTRUCTIONS */
#instructions {
  position: fixed;
  top: 32px; right: 40px;
  z-index: 600;
  font-size: 11px; letter-spacing: .1em;
  color: var(--text-muted);
  text-align: right;
  opacity: 1;
  transition: opacity 1s ease;
  line-height: 1.9;
}

/* CLOSE BUTTON */
.panel-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--panel-bg);
  transition: all 0.3s ease;
}
#panel.shown .panel-close-btn { display: flex; }
.panel-close-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
  background: rgba(255,255,255,0.08);
}
body[data-theme="light"] .panel-close-btn:hover {
  background: rgba(0,0,0,0.06);
}
.panel-close-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: 2px;
}
.sub-nav-item:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 2px;
}
.panel-close-hint {
  position: absolute;
  top: 56px; right: 16px;
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--text-dim);
  pointer-events: none;
}

/* THEME TOGGLE */
#themeToggle {
  position: fixed;
  top: 32px; left: 40px;
  z-index: 700;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  transition: all 0.3s ease;
}
#themeToggle:hover { background: rgba(255,255,255,0.1); color: var(--text); }
body[data-theme="light"] #themeToggle {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.12);
  color: var(--text-muted);
}
body[data-theme="light"] #themeToggle:hover {
  background: rgba(0,0,0,0.1);
  color: var(--text);
}

/* Light mode overrides */
body[data-theme="light"] .sub-nav-item:hover { background: rgba(0,0,0,0.04); }
body[data-theme="light"] .sub-nav-item.active { background: rgba(0,0,0,0.08); }
body[data-theme="light"] .work-company,
body[data-theme="light"] .work-role-title { color: var(--text); }
body[data-theme="light"] .work-company-duration,
body[data-theme="light"] .work-role-meta,
body[data-theme="light"] .work-role-detail { color: var(--text-muted); }
body[data-theme="light"] .work-role { border-color: rgba(0,0,0,0.08); }
body[data-theme="light"] .c-link {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
  color: var(--text);
}
body[data-theme="light"] .c-link:hover { background: rgba(0,0,0,0.08); }
body[data-theme="light"] .panel-sub-nav { border-color: rgba(0,0,0,0.1); }
body[data-theme="light"] .panel-title { color: var(--text) !important; }
body[data-theme="light"] .panel-tag span { color: var(--text-muted) !important; }

/* Panel scroll-reveal */
.panel-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.panel-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.panel-reveal:nth-child(1) { transition-delay: 0.05s; }
.panel-reveal:nth-child(2) { transition-delay: 0.1s; }
.panel-reveal:nth-child(3) { transition-delay: 0.15s; }
.panel-reveal:nth-child(4) { transition-delay: 0.2s; }
.panel-reveal:nth-child(5) { transition-delay: 0.25s; }
.panel-reveal:nth-child(6) { transition-delay: 0.3s; }
.panel-reveal:nth-child(7) { transition-delay: 0.35s; }
.panel-reveal:nth-child(8) { transition-delay: 0.4s; }
.panel-reveal:nth-child(9) { transition-delay: 0.45s; }
.panel-reveal:nth-child(n+10) { transition-delay: 0.5s; }

.entry-reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: entryIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes entryIn {
  to { opacity: 1; transform: translateY(0); }
}

/* vesting bars */
.vest-items { display: flex; flex-direction: column; gap: 12px; }
.vest-head { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 11px; }
.vest-name { color: rgba(255,255,255,0.6); }
.vest-pct { color: rgba(255,255,255,0.3); }
.vest-track { height: 3px; background: rgba(255,255,255,0.06); position: relative; overflow: hidden; }
.vest-fill { height: 100%; background: rgba(180,160,255,0.7); transition: width 1s cubic-bezier(.4,0,.2,1); }

.breath-ring {
  position: fixed; z-index: 50;
  border-radius: 50%; pointer-events: none;
  transform: translate(-50%,-50%);
  border: 1px solid rgba(255,255,255,0.0);
  transition: border-color .4s, width .4s, height .4s;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  body, .ndot, .panel-back, a, .panel-close { cursor: default !important; }
  #cur, #cur-aura { display: none !important; }
  .breath-ring, .ndot-ring { transition: none; }
  .vest-fill { transition: none; }
}
