@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #06060f;
  --bg-secondary: #0c0c1d;
  --bg-card: rgba(15, 15, 35, 0.7);
  --border-glass: rgba(120, 90, 255, 0.15);
  --accent-1: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-3: #c4b5fd;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --teal: #2dd4bf;
  --teal-glow: rgba(45, 212, 191, 0.3);
  --rose: #f472b6;
  --rose-glow: rgba(244, 114, 182, 0.3);
  --amber: #fbbf24;
  --text-primary: #f1f0ff;
  --text-secondary: rgba(241, 240, 255, 0.6);
  --text-muted: rgba(241, 240, 255, 0.35);
  --radius: 20px;
  --radius-sm: 12px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Animated Background ── */
.bg-aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.bg-aurora .orb {
  position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.18; animation: orbFloat 18s ease-in-out infinite;
}
.bg-aurora .orb:nth-child(1) { width: 600px; height: 600px; background: var(--accent-1); top: -10%; left: -10%; }
.bg-aurora .orb:nth-child(2) { width: 500px; height: 500px; background: var(--teal); top: 50%; right: -8%; animation-delay: -6s; animation-duration: 22s; }
.bg-aurora .orb:nth-child(3) { width: 450px; height: 450px; background: var(--rose); bottom: -10%; left: 30%; animation-delay: -12s; animation-duration: 25s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, -40px) scale(1.1); }
  66% { transform: translate(-40px, 50px) scale(0.9); }
}

/* ── Grid Pattern Overlay ── */
.grid-pattern {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ── Main Container ── */
.main-wrapper {
  position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px;
}

/* ── Header / Hero ── */
.hero { text-align: center; padding: 60px 0 50px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 20px; border-radius: 100px;
  background: rgba(139, 92, 246, 0.1); border: 1px solid var(--border-glass);
  font-size: 0.8rem; font-weight: 500; color: var(--accent-2);
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 28px;
  animation: fadeInDown 0.8s ease;
}
.hero-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); animation: pulse-dot 2s infinite; }

@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 900;
  line-height: 1.15; margin-bottom: 20px;
  animation: fadeInUp 0.8s ease;
}
.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--accent-2), var(--teal), var(--rose));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.1rem; color: var(--text-secondary); max-width: 620px; margin: 0 auto 36px;
  animation: fadeInUp 0.8s ease 0.2s both;
}

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 40px;
  position: relative;
  transition: var(--transition);
}
.glass-card::before {
  content: ''; position: absolute; inset: 0; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), transparent 60%);
  pointer-events: none;
}
.glass-card:hover { border-color: rgba(139, 92, 246, 0.3); }

/* ── Calculator Section ── */
.calculator-section {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
  margin-bottom: 48px; animation: fadeInUp 0.8s ease 0.3s both;
}

.calc-panel { position: relative; }
.calc-panel .panel-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-secondary); margin-bottom: 16px;
}
.panel-label .label-icon {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
}
.panel-mcg .label-icon { background: rgba(45, 212, 191, 0.12); color: var(--teal); }
.panel-mg .label-icon { background: rgba(244, 114, 182, 0.12); color: var(--rose); }

.calc-input-wrap {
  position: relative; border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3); border: 1.5px solid rgba(255,255,255,0.06);
  transition: var(--transition); overflow: hidden;
}
.calc-input-wrap:focus-within { border-color: var(--accent-1); box-shadow: 0 0 30px var(--accent-glow); }

.calc-input {
  width: 100%; padding: 22px 80px 22px 22px;
  background: transparent; border: none; outline: none;
  font-family: 'JetBrains Mono', monospace; font-size: 1.8rem; font-weight: 600;
  color: var(--text-primary); caret-color: var(--accent-2);
}
.calc-input::placeholder { color: var(--text-muted); font-weight: 400; }

.input-unit {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 0.85rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 6px 14px; border-radius: 8px;
}
.panel-mcg .input-unit { background: rgba(45, 212, 191, 0.1); color: var(--teal); }
.panel-mg .input-unit { background: rgba(244, 114, 182, 0.1); color: var(--rose); }

/* ── Swap Button ── */
.swap-btn-wrap {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
}
.swap-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--border-glass);
  background: var(--bg-secondary); color: var(--accent-2);
  display: grid; place-items: center; cursor: pointer;
  font-size: 1.3rem; transition: var(--transition);
  box-shadow: 0 0 30px rgba(0,0,0,0.4);
}
.swap-btn:hover {
  background: var(--accent-1); color: #fff; transform: rotate(180deg);
  box-shadow: 0 0 40px var(--accent-glow);
}

/* ── Formula Display ── */
.formula-bar {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 18px 28px; border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.06); border: 1px solid var(--border-glass);
  margin-bottom: 48px; animation: fadeInUp 0.8s ease 0.4s both;
}
.formula-bar .formula-label {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--accent-2);
}
.formula-bar .formula-text {
  font-family: 'JetBrains Mono', monospace; font-size: 0.95rem;
  color: var(--text-primary); font-weight: 500;
}

/* ── Interactive Diagram Section ── */
.diagram-section { margin-bottom: 48px; animation: fadeInUp 0.8s ease 0.5s both; }
.section-title {
  font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 8px;
}
.section-subtitle {
  text-align: center; color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 32px;
}

.diagram-canvas {
  position: relative; padding: 48px 32px; border-radius: var(--radius);
  background: rgba(6, 6, 15, 0.6); border: 1px solid var(--border-glass);
  overflow: hidden;
}
.diagram-canvas::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(139,92,246,0.06) 1px, transparent 0);
  background-size: 28px 28px; pointer-events: none;
}

/* Diagram Flow */
.diagram-flow {
  display: flex; align-items: center; justify-content: center; gap: 0;
  position: relative; z-index: 1; flex-wrap: wrap;
}

.diagram-node {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 28px 24px; border-radius: 16px;
  background: rgba(15, 15, 35, 0.8); border: 1.5px solid var(--border-glass);
  min-width: 160px; text-align: center;
  transition: var(--transition); position: relative;
}
.diagram-node:hover { transform: translateY(-4px); }

.node-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.4rem;
}
.node-input .node-icon { background: linear-gradient(135deg, rgba(45,212,191,0.2), rgba(45,212,191,0.05)); color: var(--teal); }
.node-process .node-icon { background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(139,92,246,0.05)); color: var(--accent-2); }
.node-output .node-icon { background: linear-gradient(135deg, rgba(244,114,182,0.2), rgba(244,114,182,0.05)); color: var(--rose); }

.node-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-secondary); }
.node-value {
  font-family: 'JetBrains Mono', monospace; font-size: 1.2rem; font-weight: 700; color: var(--text-primary);
  min-height: 1.4em;
}

.node-input:hover { border-color: var(--teal); box-shadow: 0 0 30px var(--teal-glow); }
.node-process:hover { border-color: var(--accent-1); box-shadow: 0 0 30px var(--accent-glow); }
.node-output:hover { border-color: var(--rose); box-shadow: 0 0 30px var(--rose-glow); }

/* Arrows between nodes */
.diagram-arrow {
  display: flex; align-items: center; justify-content: center;
  padding: 0 8px; color: var(--text-muted); font-size: 1.4rem;
  position: relative;
}
.arrow-line {
  width: 60px; height: 2px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-3));
  position: relative;
  opacity: 0.4; transition: opacity 0.4s;
}
.arrow-line::after {
  content: ''; position: absolute; right: -6px; top: -4px;
  width: 0; height: 0;
  border-left: 8px solid var(--accent-3); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.diagram-arrow.active .arrow-line { opacity: 1; }

/* Animated particle on arrow */
.arrow-particle {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 12px var(--accent-glow);
  top: 50%; transform: translateY(-50%); left: 0;
  opacity: 0;
}
.diagram-arrow.active .arrow-particle {
  opacity: 1;
  animation: particleMove 1.2s ease-in-out infinite;
}
@keyframes particleMove {
  0% { left: 0; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { left: calc(100% - 6px); opacity: 0; }
}

/* ── Scale Visualization ── */
.scale-visual {
  margin-top: 36px; padding: 28px; border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.04); border: 1px solid var(--border-glass);
  position: relative; z-index: 1;
}
.scale-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.scale-header span { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

.scale-bar-container { position: relative; height: 16px; border-radius: 10px; background: rgba(255,255,255,0.04); overflow: hidden; }
.scale-bar-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--teal), var(--accent-1), var(--rose));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.scale-bar-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: barShimmer 2s infinite;
}
@keyframes barShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.scale-labels {
  display: flex; justify-content: space-between; margin-top: 10px;
}
.scale-labels span { font-size: 0.75rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

/* ── Info Cards Grid ── */
.info-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  margin-bottom: 48px; animation: fadeInUp 0.8s ease 0.6s both;
}
.info-card {
  padding: 28px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  transition: var(--transition);
}
.info-card:hover { border-color: rgba(139,92,246,0.25); transform: translateY(-3px); }
.info-card .card-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.1rem; margin-bottom: 16px;
}
.info-card:nth-child(1) .card-icon { background: rgba(45,212,191,0.1); color: var(--teal); }
.info-card:nth-child(2) .card-icon { background: rgba(139,92,246,0.1); color: var(--accent-2); }
.info-card:nth-child(3) .card-icon { background: rgba(244,114,182,0.1); color: var(--rose); }
.info-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.info-card p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.7; }

/* ── Reference Table ── */
.ref-table-wrap {
  margin-bottom: 48px; animation: fadeInUp 0.8s ease 0.7s both;
}
.ref-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem;
}
.ref-table thead th {
  padding: 16px 20px; text-align: left;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-glass);
  background: rgba(139,92,246,0.04);
}
.ref-table tbody td {
  padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-family: 'JetBrains Mono', monospace; font-size: 0.88rem;
  color: var(--text-primary);
}
.ref-table tbody tr { transition: var(--transition); }
.ref-table tbody tr:hover { background: rgba(139,92,246,0.05); }
.ref-table .mcg-val { color: var(--teal); }
.ref-table .mg-val { color: var(--rose); }

/* ── FAQ Section ── */
.faq-section { animation: fadeInUp 0.8s ease 0.8s both; }
.faq-item {
  border: 1px solid var(--border-glass); border-radius: var(--radius-sm);
  margin-bottom: 12px; overflow: hidden;
  transition: var(--transition);
}
.faq-item:hover { border-color: rgba(139,92,246,0.25); }
.faq-question {
  width: 100%; padding: 20px 24px; background: transparent;
  border: none; color: var(--text-primary); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Inter', sans-serif; font-size: 0.95rem; font-weight: 600;
  text-align: left;
}
.faq-question .faq-toggle {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(139,92,246,0.1); color: var(--accent-2);
  display: grid; place-items: center; font-size: 1rem;
  transition: var(--transition); flex-shrink: 0;
}
.faq-item.active .faq-toggle { transform: rotate(45deg); background: var(--accent-1); color: #fff; }
.faq-answer {
  max-height: 0; overflow: hidden; transition: max-height 0.4s ease, padding 0.4s ease;
}
.faq-item.active .faq-answer { max-height: 200px; }
.faq-answer p {
  padding: 0 24px 20px; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.8;
}

/* ── Footer ── */
.site-footer {
  text-align: center; padding: 48px 0 0;
  border-top: 1px solid var(--border-glass); margin-top: 60px;
  color: var(--text-muted); font-size: 0.82rem;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .calculator-section { grid-template-columns: 1fr; gap: 20px; }
  .swap-btn-wrap { position: relative; left: auto; top: auto; transform: none; display: flex; justify-content: center; margin: -10px 0; }
  .swap-btn:hover { transform: rotate(180deg); }
  .glass-card { padding: 24px; }
  .info-grid { grid-template-columns: 1fr; }
  .diagram-flow { flex-direction: column; }
  .diagram-arrow { transform: rotate(90deg); padding: 4px 0; }
  .hero { padding: 36px 0 30px; }
  .calc-input { font-size: 1.3rem; padding: 18px 70px 18px 18px; }
  .main-wrapper { padding: 20px 16px 60px; }
}
