/* Base */
:root {
  --bg: #0a0a0f;
  --bg-soft: #0f1117;
  --glass: rgba(255,255,255,0.06);
  --text: #e6e8ef;
  --muted: #9aa4b2;
  --accent: #4a9eff;
  --accent-2: #00ff88;
  --card: #12131a;
  --border: #1d2030;
  --backdrop: rgba(0,0,0,0.65);
  --shadow: rgba(0,0,0,0.15);
}

html[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-soft: #ffffff;
  --glass: rgba(0,0,0,0.04);
  --text: #101321;
  --muted: #576076;
  --accent: #2b6fff;
  --accent-2: #00a36c;
  --card: #ffffff;
  --border: #e6e9f2;
  --backdrop: rgba(0,0,0,0.3);
  --shadow: rgba(0,0,0,0.1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html {
  transition: background-color 0.3s ease, color 0.3s ease;
}
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Background */
.bg-cosmos { position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(600px 400px at 10% 80%, rgba(74,158,255,.08), transparent 60%),
    radial-gradient(600px 400px at 90% 10%, rgba(0,255,136,.08), transparent 60%);
  opacity: 0.6; /* Reduce opacity to let Sacred Geometry show through */
  transition: opacity 0.3s ease;
}

/* Glass */
.glass { background: var(--glass); backdrop-filter: blur(16px); border: 1px solid var(--border); box-shadow: 0 10px 30px var(--shadow); border-radius: 16px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; margin: 16px 0; }
.header-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .2px; }
.logo { color: var(--accent); }
.nav a { color: var(--muted); text-decoration: none; margin: 0 10px; transition: color .2s ease; }
.nav a:hover { color: var(--accent); }
.toggles { display: flex; gap: 10px; }
.toggle { background: var(--card); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 8px 10px; cursor: pointer; min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center; }

/* Hero */
.hero { padding: 60px 0 24px; text-align: center; }
.headline { font-size: clamp(28px, 4vw, 42px); margin: 0 0 10px; font-weight: 800; }
.accent { color: var(--accent-2); }
.lead { color: var(--muted); max-width: 760px; margin: 0 auto 18px; }
.cta-row { display: flex; gap: 12px; justify-content: center; }
.btn { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); text-decoration: none; }
.btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--bg); border: none; }

/* Sections */
.section { padding: 36px 0; }
.section-title { margin: 0 0 14px; font-size: 20px; font-weight: 800; }
.about-grid { display: grid; grid-template-columns: 1.5fr .8fr; gap: 20px; }
.quick-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.stat { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); text-align: center; }
.stat span { font-weight: 800; font-size: 22px; display: block; }
.stat small { color: var(--muted); }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.card { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); transition: all 0.3s ease; }
.card.aurora-card { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.card.aurora-card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(74,158,255,0.2); }
.card.aurora-card:active { transform: scale(0.98); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 8px 0 0; }
.tags li { padding: 6px 10px; border-radius: 999px; background: var(--glass); border: 1px solid var(--border); }
.subtle { color: var(--muted); margin: 6px 0 8px; }
.bullets { margin: 0; padding-left: 18px; color: var(--muted); }

/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.project { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card); display: flex; flex-direction: column; height: 380px; }
.project img { width: 100%; height: 120px; object-fit: cover; display: block; filter: saturate(1.1); flex-shrink: 0; }
.project .content { padding: 32px 12px 12px 12px; display: flex; flex-direction: column; flex: 1; min-height: 0; justify-content: center; }
.project .title { font-weight: 700; margin: 0 0 6px; font-size: 14px; line-height: 1.2; }
.project .md { color: var(--muted); font-size: 12px; line-height: 1.4; margin-bottom: auto; }
.project .md p { margin: 0 0 4px; }
.project .md a { color: var(--accent); text-decoration: none; }
.project .md a:hover { text-decoration: underline; }
.project .tech-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.project .tech-tag { font-size: 10px; padding: 3px 8px; border-radius: 12px; font-weight: 600; white-space: nowrap; }

/* Timeline */
.timeline { border-left: 2px dashed var(--border); padding-left: 16px; display: grid; gap: 14px; }
.tl-item { position: relative; }
.tl-item::before { content: ''; position: absolute; left: -10px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(74,158,255,.25); }
.tl-role { font-weight: 700; }
.tl-meta { color: var(--muted); font-size: 13px; }
.tl-ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }

/* Contact */
.contact-grid { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn.link { background: var(--glass); }
.location { color: var(--muted); }

/* Footer */
.site-footer { padding: 24px 0 60px; display: flex; gap: 12px; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 24px; }
.muted { color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); opacity: 0; transition: opacity .3s ease; }
.modal-dialog { position: relative; max-width: 920px; margin: 6vh auto; padding: 0 20px; }
.modal-content { border-radius: 16px; padding: 18px; transform: translateY(8px) scale(.98); opacity: 0; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s ease; }
/* High-contrast modal backgrounds */
html:not([data-theme="light"]) .modal-content { background: rgba(15,17,23,.92); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
html[data-theme="light"] .modal-content { background: rgba(255,255,255,.96); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-title { margin: 6px 0 12px; font-size: 20px; font-weight: 800; color: var(--text); }
.modal-close { position: absolute; right: 28px; top: 10px; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.modal.show .modal-backdrop { opacity: 1; }
.modal.show .modal-content { transform: translateY(0) scale(1); opacity: 1; }
.modal-body { max-height: 70vh; overflow: auto; font-family: JetBrains Mono, monospace; color: var(--text); line-height: 1.6; }
.modal-body h1,.modal-body h2,.modal-body h3 { color: var(--text); font-family: Inter, system-ui; }
.modal-body p { color: var(--text); }
.modal-body code { background: rgba(0,0,0,.25); padding: 2px 4px; border-radius: 6px; }
html[data-theme="light"] .modal-body code { background: rgba(0,0,0,.06); }
.modal-body pre { background: rgba(0,0,0,.25); padding: 10px; border-radius: 8px; overflow: auto; }
html[data-theme="light"] .modal-body pre { background: rgba(0,0,0,.06); }

/* SPA Effects Layer */
.fx-layer { position: fixed; inset: 0; z-index: 60; }
.fx-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s ease; }
.fx-dialog { position: relative; width: min(1200px, 96%); height: min(86vh, 860px); margin: 5vh auto; border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px var(--shadow); transform: translateY(8px); opacity: 0; transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s ease; }
.fx-layer.show .fx-backdrop { opacity: 1; }
.fx-layer.show .fx-dialog { transform: translateY(0); opacity: 1; }
.fx-content { width: 100%; height: 100%; overflow: auto; background: var(--bg); }
.fx-dialog iframe { width: 100%; height: 100%; border: none; background: var(--bg); }

/* FX embedded demo components */
.fx-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 14px; height: 100%; }
.fx-canvas-wrap { position: relative; border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.fx-sidebar { display: grid; gap: 12px; align-content: start; }
.fx-card { background: var(--glass); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.fx-card h4 { margin: 0 0 6px; font-size: 14px; font-weight: 800; }
.fx-chip { display: inline-block; padding: 4px 8px; border-radius: 999px; background: var(--glass); border: 1px solid var(--border); font-size: 12px; margin: 2px 4px 0 0; }
.fx-magnet { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); cursor: pointer; transition: transform .2s ease, background .2s ease; }
.fx-magnet:hover { background: var(--glass); transform: translateY(-2px); }
.fx-morph { border-radius: 14px; padding: 14px; background: linear-gradient(135deg, rgba(74,158,255,.12), rgba(0,255,136,.10)); border: 1px solid var(--border); transition: transform .3s ease, border-color .3s ease; }
.fx-morph:hover { transform: translateY(-3px) scale(1.01); border-color: var(--accent); }

/* Responsive */
@media (max-width: 960px) {
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2,1fr); }
  .projects-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .nav { display: none; }
  .skills-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .toggles { gap: 8px; }
  .toggle { padding: 6px 8px; font-size: 14px; }
}

/* Text spacing improvements */
.section .section-content p { margin-bottom: 20px; }
.project .md p { margin-bottom: 20px; }
.modal-body p { margin-bottom: 20px; }
.modal-body li { margin-bottom: 15px; }

/* Chips and tags with more room */
.tags li { margin: 0 15px 15px 0; }
.fx-chip { margin: 6px 15px 0 0; padding: 6px 15px; }

/* Ensure card inner content breathes */
.card, .fx-card { padding: 20px; }
.project .content { padding: 20px; }

/* Additional spacing for profile section */
.profile-section p { margin-bottom: 25px; }
.profile-section h3 { margin-bottom: 15px; margin-top: 30px; }

/* About content left margin */
.about-content { margin-left: 20px; }
#about .section-title { margin-left: 20px; }

/* Effects Lab Tabs */
.fx-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.fx-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.fx-tab:hover {
  background: var(--card);
  color: var(--text);
}

.fx-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.fx-tab-content {
  position: relative;
  min-height: 400px;
}

.fx-tab-panel {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.fx-tab-panel.active {
  display: block;
  position: relative;
}

.demo-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.control-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.fx-canvas-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}

.fx-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* Rendering system canvas styling */
#renderingAmbientCanvas,
#renderingBurstCanvas {
  background: #0a0a1a;
  border-radius: 8px;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 10 !important;
  pointer-events: none;
}

#renderingAmbientCanvas {
  pointer-events: auto !important;
  cursor: grab;
}

#renderingAmbientCanvas:active {
  cursor: grabbing;
}

/* Rendering system container */
.fx-canvas-wrap {
  position: relative !important;
  width: 100% !important;
  height: 500px !important;
  overflow: hidden;
  border-radius: 8px;
}

/* Rendering system controls */
#tab-rendering .demo-controls {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  margin-bottom: 8px !important;
}

#tab-rendering .control-btn {
  font-size: 10px !important;
  padding: 4px 8px !important;
  white-space: nowrap !important;
  min-width: auto !important;
  flex: 0 0 auto !important;
}

/* Bottom control buttons */
#tab-rendering .control-btn[style*="font-size:12px"] {
  font-size: 10px !important;
  padding: 4px 8px !important;
}

/* Interactive cards: subtle tilt and magnetic hover */
.card, .project {
  transform: translateZ(0);
  transition: transform 200ms ease, box-shadow 200ms ease;
  will-change: transform;
}
.card.tilted, .project.tilted {
  box-shadow: 0 14px 28px rgba(0,0,0,.25), 0 10px 10px rgba(0,0,0,.22);
}
.magnetic-child {
  transition: transform 180ms ease;
  will-change: transform;
}
