:root {
  --bg: #1A1423;
  --nav-bg: rgba(35, 28, 46, 0.85);
  --card-bg: #231C2E;
  --card-border: #372549;
  --item-bg: #2C2238;
  --item-hover: #372549;
  --text: #EACDC2;
  --text-muted: #B07A70;
  --text-dim: #8B6A75;
  --accent: #B75D69;
  --accent-bg: rgba(183, 93, 105, 0.15);
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.15);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

body.light-mode {
  --bg: #F7F5FA;
  --nav-bg: rgba(255, 255, 255, 0.85);
  --card-bg: #FFFFFF;
  --card-border: #E8E3ED;
  --item-bg: #FDFCFD;
  --item-hover: #F3EDF7;
  --text: #2D2438;
  --text-muted: #756B82;
  --text-dim: #9E94AA;
  --accent: #D94A65;
  --accent-bg: rgba(217, 74, 101, 0.15);
  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.15);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Helvetica', Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 60px;
  margin: 0;
  box-sizing: border-box;
  transition: background-color 0.4s ease, color 0.4s ease;
}

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

nav, .card, footer {
  width: 100%;
  max-width: 560px;
}

nav {
  background: var(--nav-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin-bottom: 20px;
  position: sticky;
  top: 16px;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.nav-left { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-right { display: flex; align-items: center; gap: 10px; }

.nav-icon, .theme-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: transparent; border: none;
  color: var(--text-dim); transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav-icon:hover, .theme-btn:hover { background: var(--item-hover); color: var(--text); }
.nav-icon.active { color: var(--text); background: var(--item-hover); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 12px;
  transition: background-color 0.4s ease, border-color 0.4s ease;
  display: flex; flex-direction: column;
}

.hero { padding: 24px; }

.hero-top { 
  display: flex; 
  align-items: stretch;
  margin-bottom: 22px; 
  width: 100%;
}

.hero-top-left {
  flex: 1; 
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding-right: 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.hero-top-left .dot { margin-top: 5px; }

.hero-top-right {
  flex: 1; 
  display: flex;
  align-items: flex-start;
  justify-content: flex-end; 
  padding-left: 16px;
}

.section-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; }
.dot.accent { background: var(--accent); box-shadow: 0 0 6px rgba(183, 93, 105, 0.6); animation: pulse 2s infinite; }
.dot.success { background: var(--success); box-shadow: 0 0 6px var(--success-bg); animation: pulse-success 2s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes pulse-success { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.available-badge {
  display: inline-flex; align-items: center; gap: 6px; background: var(--success-bg);
  border: 1px solid rgba(74, 222, 128, 0.25); border-radius: 999px;
  padding: 4px 10px; font-size: 11px; font-weight: 600; color: var(--success);
  letter-spacing: 0.05em; text-transform: uppercase; text-align: left;
}

.hero-body { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.hero-text h1 { font-size: 26px; font-weight: 700; margin: 0 0 10px; color: var(--text); }
.hero-text p { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; max-width: 320px; }

.find-me-section { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.find-me-text { font-size: 13px; color: var(--text-muted); }
.social-pill {
  display: inline-flex; align-items: center; gap: 16px; background: transparent;
  border: 1px solid var(--card-border); border-radius: 999px; padding: 8px 18px;
}
.social-pill a { color: var(--text-dim); display: flex; align-items: center; justify-content: center; transition: color 0.15s, transform 0.15s; text-decoration: none; }
.social-pill a:hover { color: var(--text); transform: scale(1.1); }
.social-separator { width: 1px; height: 14px; background: var(--card-border); }

.avatar-wrap {
  width: 125px; height: 125px; border-radius: 50%;
  background: var(--item-bg); border: 3px solid var(--card-border);
  overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }

.divider { height: 1px; background: var(--card-border); margin: 0 24px; }

.projects-section { padding: 22px 24px 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.view-all {
  display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-muted);
  cursor: pointer; background: none; border: none; transition: color 0.15s; text-decoration: none;
}
.section-divider-wrap { margin: 32px 0 16px; }
.section-divider-line { height: 1px; background: var(--card-border); margin-bottom: 16px; }

.project-list { display: flex; flex-direction: column; gap: 8px; }
.project-item {
  display: flex; align-items: flex-start; gap: 14px; background: var(--item-bg);
  border: 1px solid var(--card-border); border-radius: var(--radius-md);
  padding: 14px; cursor: pointer; text-decoration: none; transition: 0.15s;
}
.project-item:hover { background: var(--item-hover); border-color: var(--accent); }

.project-image {
  position: relative; width: 70px; height: 70px; flex-shrink: 0; margin-top: 2px;
}
.project-image img.main-img { 
  width: 100%; height: 100%; object-fit: cover; display: block; 
  border-radius: 8px; border: 1px solid var(--card-border);
}

.org-badge {
  position: absolute; bottom: -6px; right: -6px; width: 36px; height: 36px;
  border-radius: 4px; border: 3px solid var(--item-bg); background: var(--card-bg);
  object-fit: cover; z-index: 2; transition: border-color 0.15s;
}
.project-item:hover .org-badge { border-color: var(--item-hover); }

.project-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; color: #fff; margin-top: 2px;
}

.project-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.project-header-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.project-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: normal; line-height: 1.3;}
.project-date { font-size: 11px; color: var(--accent); white-space: nowrap; flex-shrink: 0; margin-left: 8px; }
.project-tags { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-desc { font-size: 13px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; width: 100%; }
.project-desc ul { padding-left: 18px; margin: 4px 0 0; }
.chevron { color: var(--text-dim); margin-top: 4px;}

.exp-divider { display: flex; align-items: center; gap: 10px; margin: 24px 0 16px; }
.exp-divider span { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.exp-line { flex: 1; height: 1px; background: var(--card-border); }

.page { display: none; flex-direction: column; }
.page.active { display: flex; }
.works-hero { padding: 24px 24px 16px; position: relative;}
.works-hero-header { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 10px; }
.works-hero h1 { font-size: 26px; font-weight: 700; margin: 16px 0 10px; color: var(--text); }
.works-hero-header h1 { margin: 0; } 
.works-hero p { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin: 0; max-width: 999px; }

.about-me-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 24px; width: 100%; text-align: left; }

.blog-card {
  display: flex; flex-direction: column; background: var(--item-bg);
  border: 1px solid var(--card-border); border-radius: var(--radius-md);
  padding: 18px; cursor: pointer; transition: 0.2s; text-decoration: none; color: inherit;
}
.blog-card:hover { border-color: var(--accent); background: var(--item-hover); transform: translateY(-2px); }
.blog-card-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.blog-card-date { font-size: 12px; color: var(--accent); margin-bottom: 12px; }
.blog-card-snippet { font-size: 13px; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.blog-detail-meta {
  background: var(--item-bg); border: 1px solid var(--card-border); border-radius: var(--radius-md);
  padding: 16px 18px; margin-bottom: 24px;
}
.blog-detail-meta-row { display: flex; justify-content: space-between; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--card-border); }
.blog-detail-meta-row:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.blog-detail-meta-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.blog-detail-meta-value { font-size: 13px; font-weight: 500; color: var(--text); }

.card-footer {
  width: 100%; text-align: center; padding: 24px; border-top: 1px solid var(--card-border);
  font-size: 12px; color: var(--text-dim); margin-top: auto;
}

.masonry-gallery { column-count: 2; column-gap: 12px; padding: 0 24px 24px; }

.masonry-item {
  display: inline-block; width: 100%; margin-bottom: 12px; break-inside: avoid;
  transition: transform 0.2s ease; cursor: pointer;
}
.masonry-item:hover { transform: scale(1.02); }

.masonry-item img { 
  width: 100%; 
  height: auto; 
  display: block; 
  border-radius: var(--radius-md);
}

.masonry-item div {
  padding: 8px 4px 14px; 
  font-size: 13px; 
  color: var(--text-muted); 
  text-align: center;
  background: transparent;
  border: none;
}

.lightbox {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px);
  display: none; justify-content: center; align-items: center;
  z-index: 1000; opacity: 0; transition: opacity 0.3s ease;
}
.lightbox.active { display: flex; opacity: 1; }
.lightbox-content { position: relative; max-width: 90%; max-height: 90vh; }
.lightbox-img {
  max-width: 100%; max-height: 85vh; border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); object-fit: contain;
}
.lightbox-close {
  position: absolute; top: -40px; right: 0; color: white; font-size: 30px;
  cursor: pointer; background: none; border: none; padding: 5px;
}

svg { display: block; }

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 768px) {
  nav, .card, footer { max-width: 700px; }
  .hero-text h1 { font-size: 32px; }
  .hero-text p { font-size: 15px; max-width: 450px; }
  .avatar-wrap { width: 140px; height: 140px; }
  .masonry-gallery { column-count: 3; }
  .about-me-desc { font-size: 15px; }
}

@media (max-width: 576px) {
  body { padding: 16px 12px 40px; }
  nav { padding: 10px; gap: 5px; }
  .nav-icon { width: 32px; height: 32px; }
  .hero-body { flex-direction: column-reverse; align-items: center; text-align: center; }
  .hero-text p { max-width: 100%; }
  .find-me-section { align-items: center; }
  .avatar-wrap { width: 100px; height: 100px; margin-bottom: 10px; }
  .masonry-gallery { column-count: 2; }
  .lightbox-close { top: -35px; right: -5px; }
  .hero-top-left { padding-right: 10px; font-size: 12px; }
  .hero-top-right { padding-left: 10px; }
  .available-badge { padding: 4px 8px; font-size: 10px; }
  .works-hero-header { flex-direction: column; gap: 8px; margin: 16px 0 10px;}
  .about-me-desc { font-size: 14px; text-align: left; }
}
#loader-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  contain: paint;
}

.loader {
  width: 60px;
  aspect-ratio: 4;
  --_g: no-repeat radial-gradient(circle closest-side, var(--text) 90%, #0000);
  background: 
    var(--_g) 0%   50%,
    var(--_g) 50%  50%,
    var(--_g) 100% 50%;
  background-size: calc(100%/3) 100%;
  animation: l7 1s infinite linear;
}

@keyframes l7 {
    33%{background-size:calc(100%/3) 0%  ,calc(100%/3) 100%,calc(100%/3) 100%}
    50%{background-size:calc(100%/3) 100%,calc(100%/3) 0%  ,calc(100%/3) 100%}
    66%{background-size:calc(100%/3) 100%,calc(100%/3) 100%,calc(100%/3) 0%  }
}

.loader-hidden {
  opacity: 0;
  visibility: hidden;
}