:root{
  --brand-1:#6a11cb;
  --brand-2:#2575fc;
  --brand-3:#ff512f;
  --brand-4:#dd2476;
  --accent:#ffcc00;
  --glass-bg: rgba(255,255,255,0.08);
  --glass-border: rgba(255,255,255,0.22);
  --nav-h: 70px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Base */
html,body{
  height:100%;
  scroll-behavior:smooth;
  font-family:'Poppins',system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,'Helvetica Neue',Arial,sans-serif;
  overflow-x:hidden;
  background:#0f1117;
  color:#e9eef7;
  color-scheme: dark light;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Skip link */
.skip-link{
  position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden;
}
.skip-link:focus{
  position:fixed; left:16px; top:16px; width:auto; height:auto; padding:.5rem .75rem;
  background:#1d2433; color:#fff; border-radius:8px; z-index:2000;
}

/* Sticky Navbar */
.navbar{
  height:var(--nav-h);
  backdrop-filter: blur(10px);
  background: rgba(15,17,23,0.8);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: var(--transition);
  padding: 0 1rem;
}
.navbar.scrolled {
  background: rgba(15,17,23,0.95);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.navbar .nav-link{
  position:relative;
  font-weight:500;
  margin: 0 0.5rem;
  transition: var(--transition);
}
.navbar .nav-link::after{
  content:"";
  position:absolute;
  left:0; bottom:-6px;
  height:2px; width:0;
  background:var(--accent);
  transition:width .25s ease;
}
.navbar .nav-link:hover::after,
.navbar .nav-link.active::after{ width:100%; }

/* Profile picture with animation */
.profile-pic {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent);
  box-shadow: 0 0 30px rgba(255, 204, 0, 0.4);
  animation: float 6s ease-in-out infinite;
  margin: 0 auto 2rem;
  display: block;
}
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

/* Hero with animated gradient */
.hero{
  min-height: 100vh;
  display:flex; align-items:center; justify-content:center;
  text-align:center; padding:6rem 1rem 4rem;
  background: linear-gradient(-45deg, var(--brand-1), var(--brand-2), var(--brand-3), var(--brand-4));
  background-size: 400% 400%;
  animation: gradientBG 14s ease infinite;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 0;
}
.hero-content { position: relative; z-index: 1; }
@keyframes gradientBG{
  0%{ background-position:0% 50%; }
  50%{ background-position:100% 50%; }
  100%{ background-position:0% 50%; }
}
.hero h1{
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight:800;
  margin-bottom:.8rem;
  letter-spacing:.4px;
  line-height: 1.2;
}
.typing{
  border-right: 3px solid rgba(255,255,255,0.9);
  white-space: nowrap; overflow:hidden;
  width: 0;
  animation: typing 3.5s steps(28,end) forwards, caret .9s step-end infinite;
  display:inline-block;
}
@keyframes typing{ from{ width:0 } to{ width:100% } }
@keyframes caret{ 50%{ border-color: transparent } }

.hero .lead{
  opacity:0; transform:translateY(8px);
  animation: fadeUp .8s .8s ease forwards;
  font-size: 1.2rem;
  max-width: 700px;
  margin: 0 auto;
}
@keyframes fadeUp{ to{ opacity:1; transform:none; } }

.hero-cta { margin-top: 2rem; opacity:0; animation: fadeUp .8s 1.5s ease forwards; }

/* Sections */
section{
  scroll-margin-top: calc(var(--nav-h) + 20px);
  padding: 4rem 0;
}

.section-title {
  position: relative;
  margin-bottom: 3rem;
  font-weight: 700;
  display: inline-block;
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px; left: 0; width: 50px; height: 4px;
  background: var(--accent);
  border-radius: 2px;
}

/* Glassmorphism content cards */
.glass{
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
  transition: var(--transition);
  backdrop-filter: blur(10px);
}
.glass:hover{ 
  transform: translateY(-6px); 
  box-shadow: 0 12px 36px rgba(0,0,0,0.35);
  border-color: rgba(255,255,255,0.3);
}

/* Reveal on scroll */
.reveal{ opacity:0; transform: translateY(30px); transition: all .8s ease; }
.reveal.show{ opacity:1; transform:none; }

/* Reflection / note box */
.reflection{
  background: rgba(255, 204, 0, 0.08);
  border-left: 4px solid var(--accent);
  padding: 16px 18px;
  border-radius: 10px;
  margin-top: 20px;
}

/* Demo boxes (replacing inline styles) */
.demo-header{
  background: #f8f9fa; padding: 1rem; border-radius: 4px;
  color:#0f1117;
}
.demo-nav .demo-link{ margin-right: 1rem; color:#0f1117; text-decoration: none; }
.demo-main{
  margin: 1rem 0; padding: 1rem; background: #e9ecef; border-radius: 4px; color:#0f1117;
}
.demo-footer{
  background: #f8f9fa; padding: 1rem; border-radius: 4px; color:#0f1117;
}

.demo-flex{
  display: flex; gap: 1rem; margin-bottom: 1rem;
}
.demo-flex-item{
  padding: 1rem; color: white; border-radius: 4px; flex: 1; text-align:center;
}
.demo-flex-item.flex-2{ flex: 2; }
.bg-1{ background: #6a11cb; }
.bg-2{ background: #2575fc; }
.bg-3{ background: #ff512f; }

.demo-grid-demo{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem;
}
.demo-grid-item{
  padding: 1rem; color:white; border-radius: 4px; text-align:center;
}

/* Spinner animation for demos */
.demo-spinner{
  width: 100px; height: 100px; background: var(--accent); border-radius: 8px;
  animation: spin 2s linear infinite; margin: 0 auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

pre{
  background:#0b0d12; color:#e9eef7; padding:16px; border-radius:12px; overflow:auto;
  border:1px solid rgba(255,255,255,0.08); font-size: 0.9rem; line-height: 1.5;
}

/* FAB and Back to top */
.fab, .to-top{
  width: 56px; height:56px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:#1d2433; color:#fff; border:1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35); cursor:pointer; z-index:1030;
  transition: var(--transition);
}
.fab{ position: fixed; right: 20px; bottom: 20px; }
.fab:hover{ transform: translateY(-3px) rotate(8deg); }
.to-top{ position: fixed; left:20px; bottom:20px; opacity:0; visibility:hidden; }
.to-top.show{ opacity:1; visibility:visible; transform: translateY(-3px); }

/* Light theme (toggled) */
.light{ background:#f6f8ff; color:#0f1117; }
.light .glass{ background: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.4); }
.light .navbar{ background: rgba(255,255,255,0.9); border-color: rgba(0,0,0,0.06); }
.light .navbar.scrolled { background: rgba(255,255,255,0.95); }
.light pre{ background:#e6ebf5; color:#0f1117; border-color: rgba(0,0,0,0.08); }
.light .reflection { background: rgba(255, 204, 0, 0.12); }

/* Page content styling */
.page-content{ display:none; animation: fadeIn 0.5s ease forwards; }
.page-content.active{ display:block; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* Progress bars (kept for potential future use) */
.progress { height: 10px; background-color: rgba(255,255,255,0.1); border-radius: 5px; overflow: hidden; margin: 10px 0; }
.progress-bar { background: linear-gradient(90deg, var(--brand-1), var(--brand-2)); border-radius: 5px; transition: width 1.5s ease; }

/* Assignment section perf hints */
.assignment-section { margin-bottom: 4rem; content-visibility: auto; contain-intrinsic-size: 1px 800px; }

/* Social icons */
.social-icons{ display:flex; gap:15px; margin-top:20px; }
.social-icon{
  width:40px; height:40px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background: var(--glass-bg); border:1px solid var(--glass-border);
  color:#e9eef7; transition: var(--transition);
}
.social-icon:hover { background: var(--accent); color:#0f1117; transform: translateY(-3px); }

/* Footer */
footer{ border-top: 1px solid rgba(255,255,255,0.08); padding: 40px 0; color:#cbd5e1; }
.light footer{ border-top-color: rgba(0,0,0,0.08); color:#344256; }

/* Responsive */
@media (max-width: 768px) {
  section { padding: 3rem 0; }
  .hero { padding: 5rem 1rem 3rem; }
  .glass { padding: 20px; }
  .navbar .nav-link { margin: 0; padding: 10px 0; }
  .profile-pic { width: 180px; height: 180px; }
  .demo-grid-demo{ grid-template-columns: 1fr; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .typing{ width: auto !important; border-right: 0 !important; }
}
