/* ============================================================
   RESET & VARIABLES
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent:      #e63946;
  --accent-dim:  rgba(230,57,70,0.12);
  --bg:          #0d1117;
  --sidebar-bg:  #090e14;
  --card-bg:     #161b22;
  --card-bg2:    #1c2128;
  --text:        #c9d1d9;
  --text-muted:  #8b949e;
  --white:       #f0f6fc;
  --font:        'Be Vietnam Pro', sans-serif;
  --cursive:     'Dancing Script', cursive;
  --mono:        'Fira Code', monospace;
  --ease:        0.3s ease;
  --sidebar-w:   220px;
  --radius:      10px;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  /* copyright 34px + vscode 22px */
  padding-bottom: max(56px, calc(56px + env(safe-area-inset-bottom)));
}

/* Tránh overflow ngang toàn trang */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* ============================================================
   COPYRIGHT BAR – cố định dưới cùng toàn trang
   ============================================================ */
.copyright-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: 34px;
  background: #090909;
  border-top: 1px solid #1e1e1e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem 0 calc(var(--sidebar-w) + 1.5rem);
  z-index: 500;
  font-size: 0.72rem;
  color: #444;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
}
.copyright-bar strong { color: #666; font-weight: 600; }
.copyright-right {
  color: #333;
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

/* ============================================================
   SIDEBAR – khác bản gốc: accent bar dọc bên phải + pill nav
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 2rem 1rem 2rem 1.4rem;
  z-index: 100;
  border-right: none;
  box-shadow: 2px 0 0 0 #21262d, 4px 0 16px rgba(0,0,0,0.5);
}
/* Accent bar dọc bên phải sidebar */
.sidebar::after {
  content: '';
  position: absolute;
  right: 0; top: 15%; bottom: 15%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
  border-radius: 2px;
}

/* Logo – TranCuong08 */
.logo {
  display: flex;
  align-items: center;
  margin-bottom: 1.2rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
  background: var(--accent-dim);
  border: 1px solid rgba(230,57,70,0.2);
}

/* Sidebar Avatar */
.sidebar-avatar {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto 1.8rem;
  flex-shrink: 0;
}
.sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: block;
  filter: grayscale(15%);
  transition: filter var(--ease), transform var(--ease);
  animation: avatarGlitch 6s infinite;
}

@keyframes avatarGlitch {
  0%, 88%, 100% {
    transform: translate(0);
    filter: grayscale(15%);
    clip-path: none;
  }
  89% {
    transform: translate(-3px, 1px);
    filter: grayscale(0%) hue-rotate(90deg) saturate(2);
    clip-path: polygon(0 15%, 100% 15%, 100% 40%, 0 40%);
  }
  90% {
    transform: translate(3px, -1px);
    filter: grayscale(0%) hue-rotate(-90deg) saturate(2);
    clip-path: polygon(0 55%, 100% 55%, 100% 75%, 0 75%);
  }
  91% {
    transform: translate(-2px, 2px);
    filter: grayscale(0%) brightness(1.4) contrast(1.3);
    clip-path: polygon(0 0, 100% 0, 100% 30%, 0 30%);
  }
  92% {
    transform: translate(0);
    filter: grayscale(15%);
    clip-path: none;
  }
  /* Glitch lần 2 */
  95% {
    transform: translate(2px, -2px);
    filter: grayscale(0%) hue-rotate(180deg);
    clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
  }
  96% {
    transform: translate(-2px, 1px);
    filter: grayscale(0%) brightness(1.6);
    clip-path: polygon(0 20%, 100% 20%, 100% 45%, 0 45%);
  }
  97% {
    transform: translate(0);
    filter: grayscale(15%);
    clip-path: none;
  }
}
.sidebar-avatar:hover img {
  filter: grayscale(0%);
  transform: scale(1.05);
}
/* Vòng xoay accent */
.sidebar-avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  opacity: 0.5;
  animation: spinRing 8s linear infinite;
}
@keyframes spinRing {
  to { transform: rotate(360deg); }
}
/* Dot online xanh */
.sidebar-avatar::after {
  content: '';
  position: absolute;
  bottom: 3px; right: 3px;
  width: 10px; height: 10px;
  background: #4ade80;
  border-radius: 50%;
  border: 2px solid var(--sidebar-bg);
  box-shadow: 0 0 6px #4ade80;
}
.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.logo-num {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Nav */
.nav { display: flex; flex-direction: column; gap: 0.25rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);       /* pill shape – khác gốc */
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: color var(--ease), background var(--ease), transform var(--ease);
  border-left: none;                  /* không dùng border-left như gốc */
}
.nav-link i {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  flex-shrink: 0;
  transition: background var(--ease), color var(--ease);
}
.nav-link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.05);
  transform: translateX(3px);
}
.nav-link.active {
  color: var(--white);
  background: var(--accent-dim);
}
.nav-link.active i {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(230,57,70,0.3);
}

/* ============================================================
   THEME PANEL
   ============================================================ */
.theme-panel {
  position: fixed;
  top: 1.4rem;
  right: 1.4rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.theme-gear-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--card-bg2);
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--ease), transform var(--ease);
}
.theme-gear-btn:hover { background: var(--accent); color: #fff; }
.theme-gear-btn.spinning { animation: spin 0.6s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

.theme-dropdown {
  background: var(--card-bg2);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.95);
  transform-origin: top right;
  transition: opacity var(--ease), transform var(--ease);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.theme-dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.theme-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.color-row { display: flex; gap: 0.45rem; }
.color-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--ease), border-color var(--ease);
}
.color-dot:hover  { transform: scale(1.15); }
.color-dot.active { border-color: #fff; }

/* ============================================================
   MAIN & SECTIONS – scroll transition
   ============================================================ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  position: relative;
  height: 100vh;
  overflow: hidden;
  z-index: 2;
}

.section {
  position: absolute;
  inset: 0;
  padding: 3rem 4rem 3rem 3.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  /* Ẩn mặc định */
  opacity: 0;
  pointer-events: none;
  transform: translateY(0);
  will-change: opacity, transform;
  /* Không có transition khi ẩn */
}

/* Section đang hiển thị */
.section.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* Đang trong quá trình chuyển vào */
.section.transitioning {
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Vào từ dưới lên (scroll xuống) */
.section.enter-down {
  transform: translateY(48px);
  opacity: 0;
}

/* Vào từ trên xuống (scroll lên) */
.section.enter-up {
  transform: translateY(-48px);
  opacity: 0;
}

/* Ra theo hướng lên (khi scroll xuống) */
.section.exit-up {
  transform: translateY(-36px);
  opacity: 0;
  transition: opacity 0.38s cubic-bezier(0.4, 0, 1, 1),
              transform 0.38s cubic-bezier(0.4, 0, 1, 1);
  pointer-events: none;
}

/* Ra theo hướng xuống (khi scroll lên) */
.section.exit-down {
  transform: translateY(36px);
  opacity: 0;
  transition: opacity 0.38s cubic-bezier(0.4, 0, 1, 1),
              transform 0.38s cubic-bezier(0.4, 0, 1, 1);
  pointer-events: none;
}

/* ============================================================
   SCROLL DOTS INDICATOR
   ============================================================ */
.scroll-dots {
  position: fixed;
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.scroll-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #444;
  border: none;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s, height 0.3s;
  padding: 0;
}
.scroll-dot:hover {
  background: var(--text-muted);
  transform: scale(1.3);
}
.scroll-dot.active {
  background: var(--accent);
  height: 26px;
  border-radius: 5px;
  transform: none;
}

/* ============================================================
   HOME STATS
   ============================================================ */
.home-stats {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 1.8rem;
  background: var(--card-bg);
  border: 1px solid #30363d;
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  width: fit-content;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.1rem;
  position: relative;
}

.stat-num {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  display: inline;
}

.stat-plus {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  vertical-align: super;
  margin-left: 1px;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  margin-top: 0.25rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: #30363d;
  flex-shrink: 0;
}

/* Glow khi visible */
.stat-num.counted {
  animation: statPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes statPop {
  0%   { transform: scale(0.7); opacity: 0.4; }
  100% { transform: scale(1);   opacity: 1; }
}

@media (max-width: 600px) {
  .home-stats { gap: 0; padding: 0.7rem 0.8rem; }
  .stat-item  { padding: 0 0.7rem; }
  .stat-num   { font-size: 1.2rem; }
  .stat-label { font-size: 0.58rem; }
}

/* ============================================================
   HOME BADGES
   ============================================================ */
.home-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.8rem;
  margin-top: 0.5rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid #333;
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 500;
}
.badge i { color: var(--accent); font-size: 0.72rem; }

/* ============================================================
   TECH STACK TAGS (About)
   ============================================================ */
.tech-stack { margin-top: 1.8rem; }
.tech-stack-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.75rem;
}
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tech-tags span {
  background: var(--card-bg2);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.28rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: border-color var(--ease), color var(--ease);
  cursor: default;
}
.tech-tags span:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   PORT TAG & PORT TECH (Portfolio)
   ============================================================ */
.port-tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}
.port-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.port-tech span {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  color: #ddd;
}
.port-featured { border: 1px solid rgba(230,57,70,0.3); }

/* ============================================================
   FOOTER QUOTE
   ============================================================ */
.footer-quote {
  margin-top: 1.5rem;
  padding: 1rem 1.4rem;
  border-left: 3px solid var(--accent);
  background: var(--card-bg);
  border-radius: 0 10px 10px 0;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.footer-quote blockquote {
  font-size: 0.83rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.75;
  margin-bottom: 0.5rem;
}
.footer-copy {
  font-size: 0.72rem;
  color: #444;
  letter-spacing: 0.5px;
}

/* ============================================================
   CONTACT – form pill → square, input underline style
   ============================================================ */
/* Page title – dùng highlight underline animation thay ::after line tĩnh */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 1.8rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  position: relative;
  padding-bottom: 0.5rem;
}
.page-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(to right, var(--accent), transparent);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.section.active .page-title::after { width: 100%; }

/* Accent */
.accent { color: var(--accent); }

/* ============================================================
   REVEAL ANIMATIONS (triggered by JS)
   ============================================================ */
.reveal-up, .reveal-left, .reveal-right {
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-up    { transform: translateY(30px); }
.reveal-left  { transform: translateX(-36px); }
.reveal-right { transform: translateX(36px); }

.reveal-up.visible,
.reveal-left.visible,
.reveal-right.visible {
  opacity: 1;
  transform: translate(0);
}

/* ============================================================
   BUTTON – góc vuông hơn, có glow effect khi hover
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.6rem;
  border-radius: 8px;            /* vuông hơn bản gốc (30px) */
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--ease), color var(--ease),
              border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: transparent;
  color: var(--accent);
  box-shadow: 0 0 16px rgba(230,57,70,0.35);
  transform: translateY(-2px);
}

/* ============================================================
   HOME – glow ambient phía sau ảnh
   ============================================================ */
#home {
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.home-text { flex: 1; max-width: 520px; }

.greeting {
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.3px;
}
.cursive {
  font-family: var(--cursive);
  font-size: 1.8rem;
  font-weight: 700;
}
.terminal-prompt {
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  color: #4ade80;
  letter-spacing: 0;
  margin-right: 0.35rem;
}

.typing-line {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 1rem;
  min-height: 3rem;
  line-height: 1.3;
}
.cursor {
  color: var(--accent);
  animation: blink 0.75s step-end infinite;
  font-weight: 300;
}
@keyframes blink { 50% { opacity: 0; } }

.home-desc {
  font-size: 0.9rem;
  line-height: 1.9;
  color: var(--text-muted);
  margin-bottom: 1.6rem;
  max-width: 460px;
}

/* Image defined in IT section above */
.home-img-wrap .photo-nobg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 4px;
  mix-blend-mode: multiply;
  filter: contrast(1.12) brightness(0.85) saturate(0.8);
  display: block;
}

/* Corner – dày hơn và dài hơn */
.corner {
  position: absolute;
  width: 36px; height: 36px;
  border-color: var(--accent);
  border-style: solid;
  z-index: 2;
  pointer-events: none;
}
.corner-tl { top: -10px; left: -10px; border-width: 3px 0 0 3px; }
.corner-br { bottom: -10px; right: -10px; border-width: 0 3px 3px 0; }

/* ============================================================
   ABOUT – details dùng icon thay bold label
   ============================================================ */
.about-top { margin-bottom: 2rem; }

.about-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.9rem;
  line-height: 1.5;
}

.about-bio {
  font-size: 0.88rem;
  line-height: 1.95;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
  max-width: 900px;
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
}

.about-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 0.8rem 2rem;
  margin-bottom: 1.6rem;
  align-items: start;
}

.details-col { display: flex; flex-direction: column; gap: 0.6rem; }
.details-col p {
  font-size: 0.84rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.details-col strong {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.details-col span { color: var(--text); }

.skills-col { display: flex; flex-direction: column; gap: 0.85rem; }

.skill-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 0.28rem;
  font-weight: 500;
}
.skill-track {
  background: #2a2a2a;
  border-radius: 10px;
  height: 5px;
  overflow: hidden;
}
.skill-bar {
  height: 100%;
  background: linear-gradient(to right, var(--accent), rgba(230,57,70,0.5));
  border-radius: 10px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.4,0,0.2,1);
}

.about-btns { display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* ============================================================
   TIMELINE – dot ring thay vì solid dot
   ============================================================ */
.timeline-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.timeline-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.timeline-title::before {
  content: '';
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  flex-shrink: 0;
}

.timeline {
  position: relative;
  padding-left: 1.4rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.tl-item {
  position: relative;
  margin-bottom: 1.2rem;
}

.tl-dot {
  position: absolute;
  left: -1.4rem;
  top: 8px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  z-index: 1;
  transition: background var(--ease);
}
.tl-item:hover .tl-dot { background: var(--accent); }

.tl-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  border: 1px solid #30363d;
  transition: border-color var(--ease), transform var(--ease);
  position: relative;
  overflow: hidden;
}
/* Line accent trái giống code editor */
.tl-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--ease);
}
.tl-item:hover .tl-card::before { opacity: 1; }
.tl-card:hover { border-color: #484f58; transform: translateX(4px); }

.tl-year {
  font-size: 0.73rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.tl-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.35rem;
}
.tl-card p {
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-muted);
}

/* ============================================================
   SERVICES – card có số thứ tự nổi bật, khác gốc
   ============================================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-top: 1rem;
  counter-reset: service-counter;
}

.service-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.8rem 1.4rem 1.6rem;
  border: 1px solid #30363d;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
  cursor: default;
  position: relative;
  overflow: hidden;
  counter-increment: service-counter;
}
/* Số thứ tự mờ góc trên phải */
.service-card::before {
  content: "0" counter(service-counter);
  position: absolute;
  top: 0.8rem; right: 1rem;
  font-size: 1.8rem;
  font-weight: 800;
  color: rgba(255,255,255,0.04);
  line-height: 1;
  font-family: var(--font);
}
/* Accent bar ở đáy card */
.service-card::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 2px; width: 0;
  background: var(--accent);
  border-radius: 0 2px 0 var(--radius);
  transition: width 0.4s ease;
}
.service-card:hover { border-color: #333; transform: translateY(-5px); box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 0 1px rgba(230,57,70,0.08); }
.service-card:hover::after { width: 100%; }

.service-card i {
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 0.9rem;
  display: block;
}
.service-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.5rem;
}
.service-card p {
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--text-muted);
}
/* File tag góc dưới phải card */
.service-tag {
  position: absolute;
  bottom: 0.6rem;
  right: 0.8rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: #484f58;
  pointer-events: none;
  letter-spacing: 0.3px;
  transition: color var(--ease);
}
.service-card:hover .service-tag { color: var(--accent); }

/* ============================================================
   PORTFOLIO SECTION – ocean gradient background
   ============================================================ */

.portfolio-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(180, 220, 240, 0.9);
  margin-bottom: 1.5rem;
  letter-spacing: 0.3px;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}

.port-item {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: rgba(0, 40, 80, 0.5);
  cursor: pointer;
  /* Viền gradient biển */
  border: 1px solid rgba(0, 150, 200, 0.25);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(0,150,200,0);
  transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
.port-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.5s ease;
  filter: brightness(0.85) saturate(1.1);
}
.port-item:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 180, 230, 0.6);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(0, 150, 200, 0.2);
}
.port-item:hover img {
  transform: scale(1.06);
  filter: brightness(0.7) saturate(1.2);
}

.port-overlay {
  position: absolute;
  inset: 0;
  /* Gradient overlay màu biển sâu */
  background: linear-gradient(
    to top,
    rgba(0, 20, 50, 0.95) 0%,
    rgba(0, 40, 80, 0.7) 50%,
    rgba(0, 60, 100, 0.3) 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1.4rem;
  text-align: center;
  opacity: 0;
  transition: opacity 0.35s ease;
  gap: 0.35rem;
}
.port-item:hover .port-overlay { opacity: 1; }

.port-overlay h4 {
  color: #e0f4ff;
  font-size: 1rem;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}
.port-overlay p {
  color: rgba(160, 220, 255, 0.8);
  font-size: 0.78rem;
}

.port-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0, 150, 220, 0.9);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  margin-top: 0.4rem;
  border: 1px solid rgba(100, 210, 255, 0.4);
  transition: background var(--ease), transform var(--ease), box-shadow var(--ease);
}
.port-btn:hover {
  background: #fff;
  color: #0077b6;
  transform: scale(1.15);
  box-shadow: 0 0 14px rgba(0,180,255,0.5);
}

/* port-tag & port-tech đổi màu phù hợp ocean */
.port-tag {
  display: inline-block;
  background: rgba(0, 130, 200, 0.85);
  color: #e0f7ff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.18rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
  border: 1px solid rgba(100, 210, 255, 0.3);
}
.port-tech span {
  background: rgba(0, 100, 160, 0.5);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  color: rgba(180, 230, 255, 0.9);
  border: 1px solid rgba(0, 150, 200, 0.3);
}
.port-featured {
  border: 1px solid rgba(0, 150, 200, 0.4) !important;
}

/* Philosophy cards – ocean tint */
.philosophy {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 100, 160, 0.3);
}
.philosophy h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #b8e0ff;
  margin-bottom: 1.2rem;
}
.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.phi-card {
  background: rgba(0, 30, 60, 0.6);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  text-align: center;
  border: 1px solid rgba(0, 120, 180, 0.2);
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
  backdrop-filter: blur(4px);
}
.phi-card:hover {
  border-color: rgba(0, 180, 230, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 16px rgba(0, 150, 200, 0.1);
}
.phi-card i  { font-size: 1.4rem; margin-bottom: 0.6rem; display: block; }
.phi-card h4 { font-size: 0.85rem; font-weight: 600; color: #c8eeff; margin-bottom: 0.35rem; }
.phi-card p  { font-size: 0.78rem; color: rgba(150, 210, 240, 0.7); line-height: 1.6; }

/* ============================================================
   CONTACT – form pill → square, input underline style
   ============================================================ */
.contact-header {
  text-align: center;
  margin-bottom: 1.8rem;
}
.contact-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.contact-header p {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.contact-info-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.contact-info-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  text-align: center;
  border: 1px solid #30363d;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.contact-info-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.contact-info-card i  { font-size: 1.4rem; margin-bottom: 0.5rem; display: block; }
.contact-info-card h4 { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.5px; }
.contact-info-card p  { font-size: 0.82rem; color: var(--white); font-weight: 500; }

.send-email-header {
  text-align: center;
  margin-bottom: 1.4rem;
}
.send-email-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 0.2rem;
}
.send-email-header p {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.contact-form { display: flex; flex-direction: column; gap: 0.9rem; max-width: 800px; margin: 0 auto; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }

/* Underline style thay vì pill */
.contact-form input,
.contact-form textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #333;
  border-radius: 0;
  padding: 0.7rem 0.2rem;
  font-family: var(--font);
  font-size: 0.87rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--ease);
}
.contact-form textarea {
  border: 1px solid #333;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  resize: vertical;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--text-muted); font-size: 0.83rem; }
.contact-form input:focus { border-bottom-color: var(--accent); }
.contact-form textarea:focus { border-color: var(--accent); }

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 0.5rem;
}

.social-links-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}
.social-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.4rem 1rem;
  background: var(--card-bg);
  border: 1px solid #30363d;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  transition: border-color var(--ease), transform var(--ease),
              color var(--ease), box-shadow var(--ease);
}
.social-link-card i {
  font-size: 1.5rem;
  color: var(--accent);
  transition: transform var(--ease);
}
.social-link-card:hover {
  border-color: var(--accent);
  color: var(--white);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 16px var(--accent-dim);
}
.social-link-card:hover i { transform: scale(1.2); }

@media (max-width: 600px) {
  .social-links-grid { grid-template-columns: repeat(2, 1fr); max-width: 100%; }
}
@media (max-width: 380px) {
  .social-links-grid { grid-template-columns: repeat(2, 1fr); }
}
.soc-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius);       /* square thay vì tròn */
  background: var(--card-bg);
  border: 1px solid #2a2a2a;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: background var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
}
.soc-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ============================================================
   GLITCH EFFECT – tên trong greeting
   ============================================================ */
.glitch {
  position: relative;
  display: inline-block;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  font-family: var(--cursive);
  font-size: inherit;
  font-weight: inherit;
}
.glitch::before {
  color: #00ffff;
  clip-path: polygon(0 0, 100% 0, 100% 40%, 0 40%);
  animation: glitch-top 3s infinite linear;
  opacity: 0.7;
}
.glitch::after {
  color: #ff00c8;
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
  animation: glitch-bot 2.5s infinite linear;
  opacity: 0.7;
}
@keyframes glitch-top {
  0%,90%,100% { transform: translate(0); opacity: 0; }
  91%          { transform: translate(-2px, -1px); opacity: 0.7; }
  93%          { transform: translate(2px, 1px); opacity: 0.7; }
  95%          { transform: translate(-1px, 0); opacity: 0.7; }
  97%          { transform: translate(0); opacity: 0; }
}
@keyframes glitch-bot {
  0%,85%,100% { transform: translate(0); opacity: 0; }
  86%          { transform: translate(2px, 1px); opacity: 0.7; }
  88%          { transform: translate(-2px, -1px); opacity: 0.7; }
  90%          { transform: translate(0); opacity: 0; }
}

/* ============================================================
   VSCODE STATUS BAR – dưới copyright bar
   ============================================================ */
.vscode-bar {
  position: fixed;
  bottom: 34px;  /* ngay trên copyright bar */
  left: 0; right: 0;
  height: 22px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.8rem 0 calc(var(--sidebar-w) + 0.8rem);
  z-index: 450;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.9);
  gap: 1rem;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0.2px;
}
.vscode-bar-left  { display: flex; align-items: center; gap: 0.9rem; }
.vscode-bar-right { display: flex; align-items: center; gap: 0.9rem; }
.vscode-bar i { font-size: 0.6rem; margin-right: 0.25rem; }
.vscode-bar span { display: inline-flex; align-items: center; opacity: 0.9; }

/* Mobile: ẩn vscode bar */
@media (max-width: 600px) {
  .vscode-bar { display: none; }
}
@media (max-width: 820px) {
  .vscode-bar { padding-left: calc(60px + 0.8rem); }
}

/* ============================================================
   COLOR TERMINAL OVERLAY
   ============================================================ */
#colorTerminalOverlay {
  position: fixed;
  inset: 0;
  z-index: 7000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#colorTerminalOverlay.ct-visible {
  opacity: 1;
  pointer-events: all;
}
.ct-window {
  width: min(420px, 88vw);
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
  animation: ctPop 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes ctPop {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.ct-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}
.ct-title {
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
  color: #8b949e;
  margin-left: 0.4rem;
}
.ct-body {
  padding: 1rem 1.2rem;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.9;
  color: #c9d1d9;
  min-height: 100px;
}

/* ============================================================
   COLOR SCAN EFFECT
   ============================================================ */
#colorScanBar {
  position: fixed;
  left: 0; right: 0;
  top: -80px;
  height: 80px;
  z-index: 8000;
  pointer-events: none;
  opacity: 0;
}
#colorScanBar.scanning {
  animation: scanDown 0.85s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes scanDown {
  0%   { top: -80px; opacity: 0; }
  5%   { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100vh; opacity: 0; }
}

/* Flash nhỏ trên từng element khi scan đi qua */
.color-flash {
  animation: flashEl 0.28s ease forwards;
}
@keyframes flashEl {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(2.2) saturate(1.5); }
  100% { filter: brightness(1); }
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */
#loader {
  position: fixed;
  inset: 0;
  background: #020408;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#loaderMatrix {
  position: absolute;
  inset: 0;
  opacity: 0.12;
}

.loader-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  width: min(460px, 90vw);
}

/* Logo */
.loader-logo {
  font-family: 'Fira Code', monospace;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  animation: logoPulse 1.5s ease-in-out infinite alternate;
}
.loader-bracket { color: var(--accent); }
.loader-num     { color: #8b949e; font-size: 0.75em; }

@keyframes logoPulse {
  from { text-shadow: 0 0 10px var(--accent), 0 0 30px rgba(230,57,70,0.3); }
  to   { text-shadow: 0 0 20px var(--accent), 0 0 60px rgba(230,57,70,0.5); }
}

/* Terminal lines */
.loader-terminal {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  font-family: 'Fira Code', monospace;
  font-size: clamp(0.62rem, 1.8vw, 0.76rem);
  min-height: 140px;
}
.loader-line {
  color: #c9d1d9;
  line-height: 1.85;
  min-height: 1.3em;
  overflow: hidden;
  white-space: nowrap;
}

/* Progress bar */
.loader-bar-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.loader-bar-track {
  flex: 1;
  height: 4px;
  background: #21262d;
  border-radius: 4px;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--accent), #ff6b6b);
  border-radius: 4px;
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.1s linear;
}
.loader-percent {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--accent);
  min-width: 3rem;
  text-align: right;
}

/* ============================================================
   MATRIX RAIN CANVAS
   ============================================================ */
#matrixCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.045;
}

/* ============================================================
   SCANLINE OVERLAY – màn hình CRT nhẹ
   ============================================================ */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.06) 3px,
    rgba(0, 0, 0, 0.06) 4px
  );
}

/* ============================================================
   TERMINAL PROMPT (Home greeting)
   ============================================================ */
.terminal-prompt {
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  color: #4ade80;
  letter-spacing: 0;
  margin-right: 0.35rem;
}

/* Cursor dạng block terminal */
.cursor {
  color: var(--accent);
  animation: blink 0.75s step-end infinite;
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 1;
  vertical-align: middle;
}

/* ============================================================
   HOME RIGHT – code card + ảnh
   ============================================================ */
.home-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
  flex-shrink: 0;
}

/* --- Code Card (IDE snippet) --- */
.code-card {
  width: 300px;
  background: #0d1117;
  border-radius: 10px;
  border: 1px solid #30363d;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5),
              0 0 0 1px rgba(255,255,255,0.03);
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  line-height: 1.7;
  animation: floatCard 4s ease-in-out infinite;
}
@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.code-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}
.code-filename {
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
  color: #8b949e;
  margin-left: 0.3rem;
}

/* Traffic light dots */
.dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.code-body {
  padding: 0.85rem 1rem;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  background: #0d1117;
}
.code-body code { display: block; }

/* Syntax highlight colors */
.c-kw      { color: #ff7b72; }   /* keyword – đỏ */
.c-var     { color: #79c0ff; }   /* variable – xanh dương */
.c-prop    { color: #e3b341; }   /* property – vàng */
.c-str     { color: #a5d6ff; }   /* string – xanh nhạt */
.c-fn      { color: #d2a8ff; }   /* function – tím */
.c-bool    { color: #79c0ff; }   /* boolean */
.c-comment { color: #8b949e; font-style: italic; } /* comment – xám */

/* --- Ảnh profile (giờ nằm dưới code card) --- */
.home-img-wrap {
  position: relative;
  width: 200px;
  height: 255px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 4px;
  overflow: visible;
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0%, black 12%, black 80%, transparent 100%),
    linear-gradient(to right,  transparent 0%, black 8%,  black 92%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent 0%, black 12%, black 80%, transparent 100%),
    linear-gradient(to right,  transparent 0%, black 8%,  black 92%, transparent 100%);
  mask-composite: intersect;
}
.home-img-wrap::before {
  content: '';
  position: absolute;
  bottom: -20px; left: 50%;
  transform: translateX(-50%);
  width: 60%; height: 50px;
  background: var(--accent);
  filter: blur(36px);
  opacity: 0.22;
  border-radius: 50%;
  pointer-events: none;
}

/* ============================================================
   TERMINAL BOX (About)
   ============================================================ */
.terminal-box {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.4rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4),
              inset 0 1px 0 rgba(255,255,255,0.03);
  max-width: 680px;
}
.terminal-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}
.terminal-title {
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
  color: #8b949e;
  margin-left: 0.4rem;
}
.terminal-body {
  padding: 0.9rem 1.1rem;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.9;
}
.t-prompt {
  color: #4ade80;
  user-select: none;
  margin-right: 0.4rem;
}
.t-cmd   { color: #79c0ff; }
.t-out   { color: #8b949e; padding-left: 1.1rem; }
.t-cursor-line {
  color: #4ade80;
  animation: blink 1s step-end infinite;
}

/* ============================================================
   TECH STACK – prefix tag style
   ============================================================ */
.tech-stack-title {
  font-family: 'Fira Code', monospace;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.75rem;
  letter-spacing: -0.3px;
}

/* ============================================================
   RESPONSIVE – code card mobile
   ============================================================ */
@media (max-width: 820px) {
  .home-right { align-items: center; }
  .code-card  { width: 100%; max-width: 320px; }
  .home-img-wrap { width: 180px; height: 230px; }
}

/* ============================================================
   RESPONSIVE – TABLET
   ============================================================ */
@media (max-width: 1100px) {
  .about-details-grid { grid-template-columns: 1fr 1fr; }
  .skills-col         { grid-column: 1 / -1; }
  .services-grid      { grid-template-columns: repeat(2, 1fr); }
  .portfolio-grid     { grid-template-columns: repeat(2, 1fr); }
  .contact-info-row   { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  :root { --sidebar-w: 60px; }
  .sidebar { padding: 1.5rem 0.5rem; }
  .logo-text { display: none; }
  .logo { justify-content: center; padding: 0.5rem; }
  .sidebar-avatar { width: 42px; height: 42px; margin-bottom: 0.8rem; }
  .sidebar-avatar-ring { display: none; }
  .nav-link span { display: none; }
  .nav-link { justify-content: center; border-left: none; padding: 0.65rem; }
  .nav-link.active { background: rgba(255,255,255,0.07); }
  .section { padding: 2rem 1.5rem; }
  .home-wrapper { flex-direction: column; align-items: center; gap: 1.5rem; }
  .home-right { align-items: center; width: 100%; }
  .code-card  { width: 100%; max-width: 340px; }
  .home-img-wrap { width: 200px; height: 255px; }
  .timeline-wrapper { grid-template-columns: 1fr; }
  .copyright-bar { padding-left: calc(60px + 1rem); }
  .copyright-right { display: none; }
}

/* ============================================================
   RESPONSIVE – MOBILE (≤ 600px): Bottom Nav Bar
   ============================================================ */
@media (max-width: 600px) {
  :root { --sidebar-w: 0px; --bottom-nav-h: 60px; }

  /* Main content */
  .main {
    margin-left: 0;
    height: 100dvh;
  }

  /* Home section scroll được trên mobile */
  #home {
    display: block;
    align-items: unset;
    justify-content: unset;
    overflow-y: auto;
    padding-top: 2.5rem;
  }

  .home-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    min-height: unset;
  }

  /* Ẩn sidebar dọc */
  .sidebar {
    width: 100%;
    height: var(--bottom-nav-h);
    min-height: unset;
    bottom: 34px;
    top: auto;
    left: 0; right: 0;
    flex-direction: row;
    padding: 0;
    align-items: stretch;
    justify-content: space-around;
    border-right: none;
    box-shadow: 0 -1px 0 #1f1f1f, 0 -4px 16px rgba(0,0,0,0.4);
    z-index: 400;
  }
  .sidebar::after { display: none; }

  /* Ẩn logo trong bottom nav */
  .sidebar .logo { display: none; }
  .sidebar-avatar { display: none; }

  /* Nav dạng hàng ngang */
  .nav {
    flex-direction: row;
    width: 100%;
    gap: 0;
  }
  .nav-link {
    flex: 1;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.5rem 0.3rem;
    border-radius: 0;
    justify-content: center;
    align-items: center;
    font-size: 0.6rem;
  }
  .nav-link span {
    display: block;
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.2px;
  }
  .nav-link i {
    width: 22px; height: 22px;
    font-size: 0.95rem;
    background: transparent;
    border-radius: 6px;
  }
  .nav-link.active {
    background: transparent;
  }
  .nav-link.active i {
    background: var(--accent);
  }
  .nav-link.active span {
    color: var(--accent);
  }

  /* Main content – không margin sidebar, có padding bottom cho nav */
  .main {
    margin-left: 0;
    padding-bottom: calc(var(--bottom-nav-h) + 34px);
  }

  /* Sections */
  .section {
    padding: 1.6rem 1rem 1rem;
    padding-bottom: calc(var(--bottom-nav-h) + 50px);
  }
  #home {
    padding-top: 2rem;
  }

  /* Copyright bar */
  .copyright-bar {
    padding-left: 1rem;
    font-size: 0.65rem;
    height: 34px;
  }
  .copyright-right { display: none; }

  /* Theme panel – nhỏ hơn, tránh overlap */
  .theme-panel {
    top: 0.8rem;
    right: 0.8rem;
  }
  .theme-gear-btn { width: 34px; height: 34px; font-size: 0.9rem; }

  /* Scroll dots – ẩn trên mobile */
  .scroll-dots { display: none; }

  /* Home */
  .home-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: 0.5rem;
  }
  .home-right {
    align-items: center;
    width: 100%;
    gap: 0.8rem;
  }
  .code-card {
    width: 100%;
    max-width: 320px;
    font-size: 0.68rem;
  }
  .home-img-wrap {
    width: 140px;
    height: 178px;
  }
  .home-text { max-width: 100%; text-align: center; }
  .terminal-prompt { font-size: 0.72rem; }
  .greeting { font-size: 0.9rem; }
  .typing-line { font-size: 1.5rem; min-height: 2.2rem; justify-content: center; }
  .home-desc { font-size: 0.83rem; line-height: 1.7; max-width: 100%; margin: 0 auto 1.2rem; }
  .home-badges { justify-content: center; }
  .btn { padding: 0.55rem 1.2rem; font-size: 0.82rem; }

  /* Page title */
  .page-title { font-size: 1.5rem; margin-bottom: 1.2rem; }

  /* About */
  .about-name { font-size: 1.05rem; }
  .about-bio  { font-size: 0.82rem; }
  .about-details-grid { grid-template-columns: 1fr; gap: 0.5rem 0; }
  .about-btns { flex-direction: column; gap: 0.6rem; }
  .about-btns .btn { width: 100%; justify-content: center; }
  .timeline-wrapper { grid-template-columns: 1fr; gap: 1.2rem; margin-top: 1.2rem; }
  .tl-card { padding: 0.75rem 0.9rem; }

  /* Services */
  .services-grid { grid-template-columns: 1fr; gap: 0.8rem; }
  .service-card { padding: 1.2rem 1rem 1rem; }

  /* Portfolio */
  .portfolio-grid { grid-template-columns: 1fr; gap: 1rem; }
  /* Overlay luôn hiển thị trên mobile (không có hover) */
  .port-overlay {
    opacity: 1;
    background: linear-gradient(
      to top,
      rgba(0, 20, 50, 0.92) 0%,
      rgba(0, 40, 80, 0.55) 55%,
      transparent 100%
    );
  }
  .philosophy-grid { grid-template-columns: 1fr 1fr; gap: 0.8rem; }
  .phi-card { padding: 0.9rem 0.7rem; }

  /* Contact */
  .contact-header h3 { font-size: 1.1rem; }
  .contact-info-row { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .contact-info-card { padding: 0.9rem 0.6rem; }
  .contact-info-card i { font-size: 1.1rem; }
  .contact-info-card h4 { font-size: 0.72rem; }
  .contact-info-card p { font-size: 0.76rem; }
  .form-row { grid-template-columns: 1fr; }
  .contact-form input,
  .contact-form textarea { font-size: 0.9rem; padding: 0.85rem 0.3rem; }
  .contact-form textarea { padding: 0.85rem 0.9rem; }
  .form-footer { flex-direction: column; align-items: stretch; gap: 0.8rem; }
  .form-footer .btn { width: 100%; justify-content: center; padding: 0.75rem; }
  .social-row { justify-content: center; gap: 0.6rem; }
  .soc-btn { width: 42px; height: 42px; font-size: 0.9rem; }

  /* Home stats */
  .home-stats { width: 100%; justify-content: space-between; padding: 0.7rem 0.5rem; }
  .stat-item { padding: 0 0.5rem; }
  .stat-num  { font-size: 1.3rem; }
  .stat-label { font-size: 0.56rem; }

  /* Footer quote */
  .footer-quote { padding: 0.9rem 1rem; }
  .footer-quote blockquote { font-size: 0.78rem; }
}

/* ============================================================
   RESPONSIVE – nhỏ hơn nữa (≤ 380px)
   ============================================================ */
@media (max-width: 380px) {
  .home-img-wrap { width: 130px; height: 165px; }
  .typing-line { font-size: 1.3rem; }
  .home-badges .badge { font-size: 0.72rem; padding: 0.25rem 0.65rem; }
  .services-grid { grid-template-columns: 1fr; }
  .portfolio-grid { grid-template-columns: 1fr; }
  .contact-info-row { grid-template-columns: 1fr 1fr; }
  .about-details-grid { grid-template-columns: 1fr; }
  .philosophy-grid { grid-template-columns: 1fr; }
  .nav-link span { display: none; }
  .sidebar { height: 54px; bottom: 34px; }
}
