:root {
  --bg: #09090b;
  --card: rgba(24, 24, 27, 0.4);
  --accent: #6ee7b7;
  --accent-dim: rgba(110, 231, 183, 0.1);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --glass-border: rgba(255, 255, 255, 0.05);
}

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

html {
  scroll-behavior: smooth;
  font-family: 'Outfit', sans-serif;
  font-display: swap;
}

body {
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Accessibility: Skip to Main content (SXO) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #000;
  padding: 8px;
  z-index: 9999;
  font-weight: 700;
  transition: top 0.3s;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  top: 0;
}

/* Performance: Rendering optimization */
#skills, #projects, #certs, #experience {
  content-visibility: auto;
  contain-intrinsic-size: 1px 500px;
}

/* Noise texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url('https://grainy-gradients.vercel.app/noise.svg');
  opacity: 0.15;
  pointer-events: none;
  z-index: 1000;
}

.layout { display: flex; min-height: 100vh; }

/* Side Nav */
.sidenav {
  width: 80px;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: rgba(9, 9, 11, 0.4);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 1001;
}

.sidenav a {
  color: var(--muted);
  font-size: 1.2rem;
  transition: 0.3s;
  padding: 12px;
  border-radius: 12px;
  position: relative;
  text-decoration: none;
}

.sidenav a:hover, .sidenav a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.sidenav a::after {
  content: attr(data-label);
  position: absolute;
  left: 110%; top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: #000;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}

.sidenav a:hover::after { opacity: 1; left: 120%; }

main {
  flex: 1;
  margin-left: 80px;
  padding: 5vh 5vw;
  width: calc(100% - 80px);
  max-width: 1440px;
  margin-right: auto;
}

/* Hero */
.hero { margin-bottom: 80px; width: 100%; }

.hero span {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 1.4rem;
  display: block;
  margin-bottom: 5px;
  opacity: 0.9;
}

.hero h1 {
  font-family: 'Funnel Sans', sans-serif;
  font-size: clamp(3rem, 10vw, 5rem);
  line-height: 1;
  margin: 10px 0;
}

.hero p { color: var(--muted); font-size: 1.2rem; margin-top: 20px; }

/* Bento Grid */
.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 80px;
  grid-auto-flow: dense;
}

.card {
  background: var(--card);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 30px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.card h2 {
  font-family: 'Funnel Sans', sans-serif;
  margin-bottom: 20px;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2 i { color: var(--accent); font-size: 1rem; }

.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.row-2 { grid-row: span 2; }

/* Projects Grid */
.proj-grid { display: flex; flex-wrap: wrap; gap: 16px; }

.proj-item {
  flex: 1 1 280px;
  height: 200px;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  position: relative;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  border: 1px solid var(--glass-border);
}

.proj-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.85;
  transition: 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.proj-item:hover img { opacity: 1; transform: scale(1.1); }

.proj-overlay {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  padding: 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
  pointer-events: none;
  transform: translateY(10px);
  transition: 0.4s;
}

.proj-item:hover .proj-overlay { transform: translateY(0); }

.proj-overlay div {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Cert List */
.cert-list { display: flex; flex-wrap: wrap; gap: 12px; }

.cert-item {
  position: relative;
  flex: 1 1 240px;
  height: 180px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.cert-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.cert-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.4));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  opacity: 0;
  transition: 0.4s;
  padding: 20px;
  text-align: center;
  backdrop-filter: blur(2px);
}

.cert-item:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 10px 25px rgba(0,0,0,0.4), 0 0 15px rgba(110,231,183,0.1);
  z-index: 10;
}

.cert-item:hover .cert-overlay { opacity: 1; }
.cert-item:hover img { transform: scale(1.05); filter: brightness(0.7); }

.cert-info h4 {
  font-size: 0.95rem; color: #fff;
  margin-bottom: 4px; font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.cert-info p { font-size: 0.8rem; color: var(--accent); margin-bottom: 12px; font-weight: 500; }

.cert-view-label {
  padding: 6px 16px;
  background: var(--accent);
  color: #000;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 6px;
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(110,231,183,0.3);
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips span {
  background: rgba(255,255,255,0.05);
  padding: 5px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  border: 1px solid var(--glass-border);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(15px);
  padding: 20px;
  justify-content: center;
  align-items: center;
}

.modal.show { display: flex; }

.modal-shell {
  background: var(--bg);
  width: 95%;
  max-width: 1100px;
  height: 85vh;
  border-radius: 24px;
  border: 1px solid var(--accent);
  display: flex;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 60px rgba(110,231,183,0.15);
}

.modal-left {
  flex: 1.4;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-right {
  flex: 1;
  padding: 40px;
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.modal-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: 0.3s; }

.modal-controls {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  pointer-events: none;
}

.modal-arrow {
  pointer-events: auto;
  width: 45px; height: 45px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: 0.3s;
  border: none;
}

.modal-arrow:hover { background: var(--accent); color: #000; }

.modal-details h2 { font-size: 2rem; margin-bottom: 15px; color: var(--accent); }
.modal-details p { color: var(--muted); margin-bottom: 30px; font-size: 1rem; line-height: 1.6; }

.modal-links { display: flex; gap: 15px; margin-top: auto; }

.modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  transition: 0.3s;
}

.modal-btn.primary { background: var(--accent); color: #000; }
.modal-btn.secondary { border: 1px solid var(--glass-border); color: #fff; }
.modal-btn:hover { opacity: 0.8; transform: translateY(-3px); }

.modal-shell.cert-mode { max-width: 950px; height: auto; max-height: 90vh; }
.modal-shell.cert-mode .modal-right { display: none; }
.modal-shell.cert-mode .modal-left { flex: 1; height: auto; min-height: 400px; }
.modal-shell.cert-mode .modal-img { max-height: 85vh; padding: 10px; }

.cert-floating-cap {
  position: absolute;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  padding: 12px 28px;
  border-radius: 50px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  pointer-events: none;
  opacity: 1;
  transition: 0.3s;
  z-index: 20;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  white-space: nowrap;
}

.close-btn {
  position: absolute;
  top: 20px; right: 20px;
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  z-index: 10;
  background: rgba(0,0,0,0.5);
  width: 45px; height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
}

.close-btn:hover { background: var(--accent); color: #000; }

/* Footer */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--glass-border);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Timeline */
.timeline { position: relative; padding-left: 20px; margin-top: 10px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.timeline-item { position: relative; margin-bottom: 25px; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px; top: 6px;
  width: 10px; height: 10px;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 50%;
  z-index: 1;
}

.timeline-item:hover::before { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.timeline-content {
  background: rgba(255,255,255,0.02);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  transition: 0.3s;
}

.timeline-item:hover .timeline-content {
  background: rgba(255,255,255,0.05);
  border-color: var(--accent);
  transform: translateX(5px);
}

.tm-title { display: block; font-weight: 700; color: var(--accent); font-size: 0.95rem; }
.tm-org { display: block; font-size: 0.8rem; color: var(--text); margin: 2px 0 5px; }
.tm-desc { font-size: 0.75rem; color: var(--muted); line-height: 1.4; }

/* Utility Classes */
.hero-subtitle { font-family: 'Funnel Sans', sans-serif; }
.hero-desc { max-width: 800px; line-height: 1.6; }
.hero-roles { margin-top: 20px; color: var(--accent); font-weight: 700; font-size: 0.9rem; letter-spacing: 2px; }
.hero-cta-wrap { margin-top: 30px; }
.hero-cta { background: var(--accent); color: #000; padding: 12px 30px; border-radius: 50px; text-decoration: none; font-weight: 700; transition: 0.3s; display: inline-block; }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 20px; }
.skills-category { font-size: 0.9rem; color: var(--accent); margin-bottom: 10px; }

.edu-list { list-style: none; display: flex; flex-direction: column; gap: 20px; }
.edu-meta { font-size: 0.85rem; color: var(--muted); }
.edu-divider { opacity: 0.1; margin: 0; border: none; border-top: 1px solid var(--text); }

.contact-links { display: flex; gap: 20px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.contact-item { text-decoration: none; color: var(--text); font-size: 0.9rem; }
.contact-social { color: var(--accent); font-size: 1.5rem; }
.contact-btn { border: 1px solid var(--accent); color: var(--accent); padding: 8px 20px; border-radius: 8px; text-decoration: none; font-size: 0.85rem; margin-left: 10px; }

/* Responsive */
@media (max-width: 1200px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .col-3 { grid-column: span 2; }
}

@media (max-width: 1024px) {
  .modal-shell { flex-direction: column; height: 95vh; }
  .modal-right { padding: 25px; }
}

@media (max-width: 900px) {
  main { margin-left: 0; width: 100%; padding: 4vh 4vw; }
  .sidenav { width: 100%; height: 60px; top: auto; bottom: 0; flex-direction: row; border-right: none; border-top: 1px solid var(--glass-border); padding-top: 5px; }
  .sidenav a::after { display: none; }
  .bento { grid-template-columns: 1fr; gap: 20px; }
  .col-2, .col-3 { grid-column: span 1; }
  .hero h1 { font-size: 3.5rem; }
  #skills > div { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 2.5rem; }
  .card { padding: 20px; }
  .proj-grid { flex-direction: column; }
}
