/* =========================================================
   Titus Nguyen — style.css
   1. Biến màu (theme sáng / tối)
   2. Reset & base
   3. Layout chung
   4. Components (card, tag, button)
   5. Thanh điều hướng (nav)
   6. Hero (phần đầu trang)
   7. Học vấn (timeline)
   8. Các mục khác: hoạt động, liên hệ, footer
   9. Thanh cuộn "người leo dây" (rail)
   10. Tiện ích (utilities)
   11. Giảm chuyển động
   ========================================================= */

/* ---------- 1. Biến màu — đổi màu chủ đạo: sửa --accent ---------- */
:root {
  --bg: #f7f8fb;
  --card: #fff;
  --ink: #141a2a;
  --mute: #58627a;
  --line: #e1e5ef;
  --accent: #1d4ed8;
  --soft: #dbe6ff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #080c18;
    --card: #121a2e;
    --ink: #e9ecf5;
    --mute: #9aa6c3;
    --line: #25304d;
    --accent: #60a5fa;
    --soft: #14264d;
  }
}

:root[data-theme=dark] {
  --bg: #080c18;
  --card: #121a2e;
  --ink: #e9ecf5;
  --mute: #9aa6c3;
  --line: #25304d;
  --accent: #60a5fa;
  --soft: #14264d;
}

/* ---------- 2. Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  background: transparent; /* để thấy canvas nền phía sau */
  color: var(--ink);
  font: 16px/1.65 'Be Vietnam Pro', system-ui, sans-serif;
}

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

h1 {
  font-size: clamp(2rem, 6vw, 3.1rem);
  line-height: 1.2;
  font-weight: 800;
  margin: 8px 0 12px;
}

h2 { font-size: 1.5rem; margin-bottom: 22px; }

/* Canvas hiệu ứng nền */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- 3. Layout chung ---------- */
.wrap { max-width: 920px; margin: auto; padding: 0 20px; }

section {
  padding: 52px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 60px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* ---------- 4. Components ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }

.card p,
.mute { color: var(--mute); }

.tag {
  display: inline-block;
  background: var(--soft);
  color: var(--accent);
  border-radius: 99px;
  padding: 3px 12px;
  font-size: .82rem;
  margin: 8px 6px 0 0;
}

.btn {
  display: inline-block;
  margin: 22px 10px 0 0;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  font-weight: 500;
}
.btn.main { background: var(--accent); color: var(--bg); }

/* ---------- 5. Thanh điều hướng ---------- */
nav {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}

nav .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
  padding-top: 14px;
  padding-bottom: 14px;
  white-space: nowrap;
  font-size: .92rem;
}

nav a { color: var(--mute); }
nav b { margin-right: auto; }

nav button {
  font: inherit;
  font-size: .82rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 12px;
  cursor: pointer;
}

/* Nhóm nút Ngôn ngữ / Sáng-Tối */
.ctl {
  position: sticky;
  right: 0;
  display: flex;
  gap: 8px;
  background: var(--bg);
  padding-left: 8px;
}

@media (max-width: 700px) {
  nav .wrap {
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 14px;
    white-space: normal;
    font-size: .84rem;
  }
  nav b { flex: 1; order: -2; }
  .ctl { order: -1; margin-left: auto; position: static; }
}

/* ---------- 6. Hero ---------- */
.hero {
  display: flex;
  gap: 36px;
  align-items: center;
  padding-top: 64px;
  padding-bottom: 64px;
  flex-wrap: wrap-reverse;
}
.hero > div:first-child { flex: 1; min-width: 270px; }

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--soft);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 3rem;
  font-weight: 800;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 7. Học vấn (timeline) ---------- */
.line { list-style: none; border-left: 2px solid var(--line); }
.line li { padding: 0 0 22px 22px; position: relative; }
.line li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- 8. Hoạt động, liên hệ, footer ---------- */
details summary { cursor: pointer; font-weight: 500; }

.contact { overflow-wrap: anywhere; }

.site-footer {
  padding-top: 24px;
  padding-bottom: 36px;
  border-top: 1px solid var(--line);
}

/* ---------- 9. Thanh cuộn: người leo dây, mỗi chấm là một mục ---------- */
#rail {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  z-index: 3;
}

#rope {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  border-left: 2px dotted var(--line);
}

.stop {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  transition: background .3s, transform .2s;
}
.stop.on { background: var(--accent); }
.stop:hover,
.stop:focus-visible { transform: translate(-50%, -50%) scale(1.6); }

#climber {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: top .5s cubic-bezier(.34, 1.25, .5, 1);
}
#climber svg {
  display: block;
  width: 31px;
  height: 32px;
  overflow: visible;
  filter: drop-shadow(0 1px 2px rgba(10, 20, 40, .22));
}
#climber.moving svg { animation: step .28s ease-in-out 2; }

@keyframes step {
  50% { transform: translateY(-3px) rotate(-7deg); }
}

#clabel {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 12px;
  white-space: nowrap;
  font-size: .76rem;
  color: var(--mute);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 10px;
  opacity: 0;
  transition: opacity .3s;
}
#rail:hover #clabel,
#climber.moving #clabel { opacity: 1; }

@media (max-width: 1060px) {
  #rail { display: none; }
}

/* ---------- 10. Tiện ích: khoảng cách phía trên ---------- */
.mt-6  { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-20 { margin-top: 20px; }

/* ---------- 11. Tôn trọng cài đặt "giảm chuyển động" ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
