:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
  --accent: #6c8aff;
  --accent-hover: #8aa2ff;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Courier New', Courier, monospace;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: 2rem; margin-bottom: 0.5em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

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

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* Navbar */
.site-navbar {
  padding: 1.5rem 0 1rem;
  text-align: center;
}

.titlename {
  width: min(200px, 20%);
  padding: 0.5rem 0;
  transition: opacity var(--transition);
}

.titlename:hover {
  opacity: 0.8;
}

.center-pills {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.center-pills .nav-item .nav-link {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1rem;
  color: var(--text-secondary);
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
  transition: all var(--transition);
  border: 1px solid transparent;
  font-weight: 500;
}

.center-pills .nav-item .nav-link:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.06);
  border-color: var(--border-subtle);
}

.center-pills .nav-item .nav-link.active {
  color: var(--text-primary);
  background-color: rgba(108, 138, 255, 0.12);
  border-color: rgba(108, 138, 255, 0.25);
  font-weight: 600;
}

/* Hero / Home page */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#myVideo {
  position: fixed;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  z-index: -1;
  opacity: 0.4;
}

.hero-panel {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 3rem 4rem;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.hero-panel img {
  width: 60%;
  margin-bottom: 1.5rem;
}

.hero-panel h4 {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn-dark {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  padding: 0.6rem 2rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.btn-dark:hover,
.btn-dark:focus,
.btn-dark:active {
  color: #fff;
  background-color: rgba(108, 138, 255, 0.2);
  border-color: rgba(108, 138, 255, 0.4);
  box-shadow: 0 0 20px rgba(108, 138, 255, 0.15);
}

/* Main content area */
.main {
  padding-bottom: 3rem;
}

.main > .container,
.main > .container-fluid {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Page headers */
.page-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
}

/* Rows and sections */
.row {
  margin-bottom: 2.5rem;
}

/* Portfolio grid */
.portfolio-item {
  margin-bottom: 2.5rem;
}

.portfolio-item > a {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.portfolio-item > a:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.portfolio-item > a img,
.portfolio-item > a video {
  width: 100%;
  display: block;
  transition: opacity var(--transition);
}

.portfolio-item > a:hover img,
.portfolio-item > a:hover video {
  opacity: 0.9;
}

.portfolio-item h4 {
  margin-top: 1rem;
  font-size: 1rem;
}

.portfolio-item h4 a {
  color: var(--text-primary);
}

.portfolio-item h4 a:hover {
  color: var(--accent);
}

.portfolio-item > p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Project detail pages */
.project-part {
  margin-bottom: 2rem;
}

.project-part-img {
  margin: 1.5rem 0;
  border-radius: var(--radius-sm);
}

.project-part-description {
  padding: 1rem 0;
  line-height: 1.8;
}

.project-part-codeblock {
  margin: 1.5rem 0;
}

/* Code dropdown buttons */
.codebutton {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1rem;
  outline: none !important;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.codebutton:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-card-hover);
}

.codebutton::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  float: right;
  transition: transform var(--transition);
}

.codebutton.collapsed::after {
  content: '\f105';
}

/* About page: qualification list */
.icons-ul {
  list-style: none;
  padding-left: 0;
}

.icons-ul li {
  padding: 0.35rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.icons-ul li::before {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--accent);
  position: absolute;
  left: 0;
  font-size: 0.8rem;
  top: 0.55rem;
}

/* About page: tech logos */
.img-center {
  display: block;
  margin: 0 auto 1rem;
  max-height: 160px;
  transition: transform var(--transition);
}

.img-center:hover {
  transform: scale(1.05);
}

/* Image responsive */
.img-responsive {
  width: 100%;
  border-radius: var(--radius-sm);
}

/* Resume image */
#resume-img {
  width: 100%;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-sm);
}

.header {
  width: 80%;
}

/* Contact page */
.contact-links {
  list-style: none;
  padding: 0;
}

.contact-links li {
  padding: 0.75rem 0;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.contact-links li i {
  width: 1.5rem;
  text-align: center;
  color: var(--accent);
}

.contact-links a {
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}

.contact-links a:hover {
  border-bottom-color: var(--accent);
}

/* Carousel */
.carousel {
  border-radius: var(--radius);
  overflow: hidden;
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer a:hover {
  color: var(--accent);
}

/* Error page */
.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-page h1 {
  font-size: 4rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.error-page p {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

/* Scroll fade-in animation */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .hero-panel {
    padding: 2rem 1.5rem;
  }

  .hero-panel img {
    width: 80%;
  }

  .main > .container,
  .main > .container-fluid {
    padding: 0 1rem;
  }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }

  .titlename {
    width: min(160px, 35%);
  }

  .center-pills .nav-item .nav-link {
    font-size: 0.9rem;
    padding: 0.4rem 1rem;
  }
}

@media (max-width: 480px) {
  .center-pills {
    gap: 0.15rem;
  }

  .center-pills .nav-item .nav-link {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
  }
}
