/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  --bg-primary:      #0d1117;
  --bg-secondary:    #161b22;
  --bg-card:         #1c2128;
  --bg-card-hover:   #212830;
  --accent:          #58a6ff;
  --accent-glow:     rgba(88, 166, 255, 0.15);
  --expert-color:    #3fb950;
  --expert-bg:       rgba(63, 185, 80, 0.12);
  --advanced-color:  #d29922;
  --advanced-bg:     rgba(210, 153, 34, 0.12);
  --inter-color:     #58a6ff;
  --inter-bg:        rgba(88, 166, 255, 0.1);
  --text-primary:    #e6edf3;
  --text-secondary:  #cdd9e5;
  --text-muted:      #8b949e;
  --border:          #30363d;
  --border-hover:    #484f58;
  --radius:          8px;
  --radius-lg:       12px;
  --font-sans:       'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:       'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --section-pad-y:   5rem;
  --max-width:       1100px;
  --nav-height:      64px;
  --transition:      0.2s ease;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

h1, h2, h3 { line-height: 1.2; }

strong { color: var(--text-primary); font-weight: 600; }

/* ============================================================
   Blazor Loading & Errors
   ============================================================ */
.loading-progress {
  display: block;
  width: 8rem;
  height: 8rem;
}

.loading-progress circle {
  fill: none;
  stroke: var(--border);
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--accent);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

#blazor-error-ui {
  background: #2d1117;
  border-top: 1px solid #f85149;
  bottom: 0; left: 0;
  color: var(--text-primary);
  display: none;
  padding: 0.75rem 1.5rem;
  position: fixed;
  width: 100%;
  z-index: 9999;
}

#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.navbar-brand {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}
.navbar-brand:hover { opacity: 1; }
.brand-mono { color: var(--text-primary); }
.brand-dot { color: var(--text-muted); }
.brand-accent { color: var(--accent); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.nav-link {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-card);
  opacity: 1;
}

.nav-link.active { color: var(--accent); }

/* Hamburger */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle-label span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

@media (max-width: 768px) {
  .nav-toggle-label { display: flex; }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    gap: 0.25rem;
  }

  .nav-toggle:checked ~ .nav-links { display: flex; }

  .nav-toggle:checked ~ .nav-toggle-label span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle:checked ~ .nav-toggle-label span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle:checked ~ .nav-toggle-label span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ============================================================
   Section Base
   ============================================================ */
.portfolio-section {
  padding: var(--section-pad-y) 1.5rem;
}

.portfolio-section:nth-of-type(odd) {
  background-color: var(--bg-primary);
}

.portfolio-section:nth-of-type(even) {
  background-color: var(--bg-secondary);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 3rem;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* ============================================================
   Hero Section
   ============================================================ */
.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(var(--nav-height) + 2rem) 1.5rem 4rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(88, 166, 255, 0.08) 0%, transparent 60%),
    var(--bg-primary);
  position: relative;
}

.hero-inner {
  max-width: var(--max-width);
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.hero-content {
  animation: fadeSlideUp 0.8s ease-out both;
}

.hero-greeting {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.hero-name {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.hero-role {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.hero-cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
  font-weight: 300;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-sub {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero-badges {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.hero-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
}

.hero-badge-accent {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--inter-bg);
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
}
.btn-primary:hover { background: #79b8ff; border-color: #79b8ff; opacity: 1; }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }

.btn-icon { width: 1rem; height: 1rem; }

/* Code block decoration */
.hero-decoration {
  animation: fadeSlideUp 0.8s 0.2s ease-out both;
}

.hero-code-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.8;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.code-line { color: var(--text-secondary); }
.code-indent { padding-left: 1.5rem; }
.code-keyword { color: #ff7b72; }
.code-var { color: #ffa657; }
.code-prop { color: var(--text-primary); }
.code-str { color: var(--expert-color); }
.code-num { color: #79b8ff; }

/* Scroll hint */
.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  animation: bounce 2s ease-in-out infinite;
  display: flex;
}
.hero-scroll-hint svg { width: 1.5rem; height: 1.5rem; }
.hero-scroll-hint:hover { color: var(--accent); opacity: 1; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(6px); }
}

/* ============================================================
   About Section
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: start;
}

.about-text p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.8;
}

.about-text p:last-child { margin-bottom: 0; }

.about-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  min-width: 280px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.stat-number {
  display: block;
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ============================================================
   Skills Section
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  transition: border-color var(--transition), transform var(--transition);
}

.skill-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.skill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.skill-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.skill-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.skill-badge-expert   { color: var(--expert-color);   background: var(--expert-bg);   }
.skill-badge-advanced { color: var(--advanced-color); background: var(--advanced-bg); }
.skill-badge-intermediate { color: var(--inter-color); background: var(--inter-bg);   }

.skill-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.skill-bar-fill {
  height: 100%;
  border-radius: 4px;
  width: calc(var(--years) / var(--max-years) * 100%);
  background: linear-gradient(90deg, var(--accent), var(--expert-color));
  transition: width 1s ease;
}

.skill-years {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================================================
   Projects Section
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(88, 166, 255, 0.08);
}

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-client {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.project-period {
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--inter-bg);
  border: 1px solid rgba(88, 166, 255, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.project-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tech-tag {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  transition: border-color var(--transition), color var(--transition);
}

.tech-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   Education Section
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -1.6rem;
  top: 0.35rem;
  width: 0.875rem;
  height: 0.875rem;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: border-color var(--transition);
}

.timeline-content:hover { border-color: var(--accent); }

.timeline-degree {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.timeline-institution {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.timeline-period {
  font-size: 0.8rem;
  color: var(--accent);
  font-family: var(--font-mono);
  background: var(--inter-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  border: 1px solid rgba(88, 166, 255, 0.2);
}

/* ============================================================
   Languages Section
   ============================================================ */
.languages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.language-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color var(--transition), transform var(--transition);
}

.language-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.language-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.language-level {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.language-dots {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-filled  { background: var(--accent); }
.dot-empty   { background: var(--border); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-inner p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links a {
  color: var(--accent);
  margin: 0 0.5rem;
}

.footer-copy { font-size: 0.8rem; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .hero-badges,
  .hero-actions {
    justify-content: center;
  }

  .hero-decoration { order: -1; }

  .hero-code-block { font-size: 0.78rem; }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .about-stats {
    min-width: unset;
    grid-template-columns: repeat(4, 1fr);
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 480px) {
  :root { --section-pad-y: 3rem; }

  .about-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-code-block { display: none; }
}
