/* ==========================================================================
   Danh thiếp số – TS. Đinh Văn Thành
   Mobile-first. Toàn bộ giá trị thiết kế chính nằm trong :root bên dưới.
   ========================================================================== */

:root {
  /* Màu sắc */
  --color-navy: #1e3769;          /* màu nhận diện chủ đạo */
  --color-navy-dark: #152a52;     /* hover nút chính */
  --color-navy-soft: #e8edf6;     /* nền nhẹ cho nút phụ */
  --color-white: #ffffff;
  --color-tint: #f5f7fb;          /* nền xám xanh rất nhạt phân tách khu vực */
  --color-portrait-bg: #dce5f3;   /* trùng nền ảnh chân dung */
  --color-text: #1b2333;          /* chữ nội dung */
  --color-muted: #566176;         /* chữ phụ */
  --color-line: #dfe4ee;          /* đường viền mảnh */
  --color-focus: #8aa6dc;

  /* Typography */
  --font-sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-body: 1rem;
  --fs-small: 0.9375rem;
  --fs-name: clamp(1.875rem, 1.2rem + 3.2vw, 3.25rem);
  --fs-role: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-h2: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);

  /* Khoảng cách */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --gutter: 1rem;                 /* lề trái/phải, tăng dần theo màn hình */
  --section-y: 3rem;

  /* Bố cục & hình khối */
  --container: 1160px;
  --header-h: 64px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 35, 70, 0.06);
  --shadow: 0 10px 30px -12px rgba(20, 35, 70, 0.18);
  --tap: 48px;                    /* chiều cao vùng chạm nút */
  --quickbar-h: 68px;
  --ease: 160ms ease;
}

@media (min-width: 640px)  { :root { --gutter: 1.5rem; --section-y: 4rem; } }
@media (min-width: 1024px) { :root { --gutter: 2rem;   --section-y: 5.5rem; --header-h: 72px; } }

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-white);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, figure, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-navy);
  color: var(--color-white);
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

.icon { width: 20px; height: 20px; flex: none; fill: currentColor; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--color-line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  text-decoration: none;
  color: var(--color-navy);
}
.brand__logo { width: 40px; height: 40px; object-fit: contain; }
.brand__name { font-size: var(--fs-small); font-weight: 600; line-height: 1.3; }

.site-nav { display: none; }
.site-nav ul { display: flex; gap: var(--space-2); }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--space-3);
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 8px;
  transition: color var(--ease), background-color var(--ease);
}
.site-nav a:hover { color: var(--color-navy); background: var(--color-navy-soft); }

@media (min-width: 768px) {
  .site-nav { display: block; }
  .brand__logo { width: 44px; height: 44px; }
}

/* ---------- Nút ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: var(--space-3) var(--space-5);
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
}

.btn--primary { background: var(--color-navy); color: var(--color-white); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--color-navy-dark); }

.btn--outline { background: var(--color-white); color: var(--color-navy); border-color: rgba(30, 55, 105, 0.35); }
.btn--outline:hover { border-color: var(--color-navy); background: var(--color-navy-soft); }

.btn--soft { background: var(--color-navy-soft); color: var(--color-navy); }
.btn--soft:hover { background: #dbe3f1; }

.btn--light { background: var(--color-white); color: var(--color-navy); }
.btn--light:hover { background: var(--color-navy-soft); }

/* ---------- Hero ---------- */
.hero { padding-block: var(--space-5) var(--section-y); }

.hero__inner {
  display: grid;
  gap: var(--space-5);
}

.hero__portrait {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
  border-radius: var(--radius-lg);
  background: var(--color-portrait-bg);
  overflow: hidden;
  /* Mobile: khung ngang hơn ảnh gốc để tên không bị đẩy xa; neo trên cùng để giữ trọn khuôn mặt */
  aspect-ratio: 6 / 5;
}
.hero__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
}

.hero__content { text-align: center; }

.hero__name {
  font-size: var(--fs-name);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--color-navy);
}
.hero__degree { font-weight: 600; }

.hero__role {
  margin-top: var(--space-3);
  font-size: var(--fs-role);
  font-weight: 600;
  color: var(--color-navy);
}
.hero__org {
  margin-top: var(--space-1);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--color-text);
}

.hero__summary {
  max-width: 36rem;
  margin: var(--space-5) auto 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-line);
  color: var(--color-muted);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
.actions .btn { padding-inline: var(--space-3); white-space: nowrap; }
.actions .btn--primary { grid-column: 1 / -1; }

.vcard-status {
  min-height: 1.5em;
  margin-top: var(--space-2);
  font-size: var(--fs-small);
  color: var(--color-muted);
}

@media (min-width: 560px) {
  .actions { display: flex; flex-wrap: wrap; justify-content: center; }
  .actions .btn { padding-inline: var(--space-5); }
}

@media (min-width: 900px) {
  .hero { padding-block: var(--space-8) var(--section-y); }
  .hero__inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: center;
    gap: var(--space-8);
  }
  .hero__content { order: -1; text-align: left; }
  .hero__summary { margin-left: 0; }
  .actions { justify-content: flex-start; }

  .hero__portrait {
    max-width: 440px;
    margin-inline: auto 0;
    aspect-ratio: 690 / 907;   /* tỉ lệ gốc của ảnh – không cắt */
    overflow: visible;
    background: transparent;
  }
  .hero__portrait img {
    position: relative;
    z-index: 1;
    border-radius: var(--radius-lg);
    background: var(--color-portrait-bg);
    box-shadow: var(--shadow);
  }
  /* Khung navy mảnh lệch nhẹ phía sau ảnh */
  .hero__portrait::before {
    content: "";
    position: absolute;
    inset: 20px -20px -20px 20px;
    border: 1px solid rgba(30, 55, 105, 0.45);
    border-radius: var(--radius-lg);
  }
}

/* ---------- Section chung ---------- */
.section { padding-block: var(--section-y); }
.section--tint { background: var(--color-tint); }

.section__head { margin-bottom: var(--space-6); }
.section__title {
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-navy);
}
.section__title::before {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-bottom: var(--space-4);
  background: var(--color-navy);
  border-radius: 2px;
}

@media (min-width: 1024px) {
  .split {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: var(--space-8);
    align-items: start;
  }
  .section__head { margin-bottom: 0; }
}

/* ---------- Thông tin cá nhân & học vấn ---------- */
.facts {
  display: grid;
  column-gap: var(--space-7);
}
.facts__item {
  padding-block: var(--space-4);
  border-top: 1px solid var(--color-line);
}
.facts dt {
  font-size: var(--fs-small);
  color: var(--color-muted);
}
.facts dd {
  margin-top: var(--space-1);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

@media (min-width: 640px) {
  .facts { grid-template-columns: 1fr 1fr; }
}

/* ---------- Timeline ---------- */
.timeline {
  --tl-x: 7px;                   /* vị trí đường timeline */
  position: relative;
  max-width: 760px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: var(--tl-x);
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: var(--color-line);
}

.timeline__item {
  position: relative;
  padding-left: calc(var(--tl-x) + 26px);
}
.timeline__item + .timeline__item { margin-top: var(--space-6); }

.timeline__item::before {
  content: "";
  position: absolute;
  left: calc(var(--tl-x) - 6px);
  top: 6px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--color-navy);
  border-radius: 50%;
  background: var(--color-white);
}

.timeline__time {
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-navy);
  font-variant-numeric: tabular-nums;
}
.timeline__role {
  margin-top: var(--space-1);
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}
.timeline__org {
  margin-top: 2px;
  color: var(--color-muted);
}

/* Nhấn nhẹ giai đoạn hiện tại */
.timeline__item--current::before {
  background: var(--color-navy);
  box-shadow: 0 0 0 4px var(--color-navy-soft);
}
.timeline__item--current .timeline__role { color: var(--color-navy); font-weight: 700; }

@media (min-width: 768px) {
  .timeline { --tl-x: 9.5rem; }
  .timeline__item {
    display: grid;
    grid-template-columns: var(--tl-x) minmax(0, 1fr);
    padding-left: 0;
  }
  .timeline__time {
    padding-right: var(--space-6);
    padding-top: 3px;
    font-size: 1rem;
    text-align: right;
  }
  .timeline__body { padding-left: var(--space-6); }
  .timeline__role { margin-top: 0; }
  .timeline__item::before { top: 9px; }
}

/* ---------- Liên hệ ---------- */
.contact {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-navy);
  color: var(--color-white);
}
.contact__title {
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.3;
}
.contact__list { display: grid; gap: var(--space-4); }
.contact__list li { display: grid; gap: 2px; min-width: 0; }
.contact__label { font-size: var(--fs-small); color: rgba(255, 255, 255, 0.72); }
.contact__value {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  font-size: clamp(1.125rem, 1rem + 0.8vw, 1.375rem);
  font-weight: 600;
  color: var(--color-white);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 5px;
  transition: text-decoration-color var(--ease);
}
.contact__value:hover { text-decoration-color: var(--color-white); }
.contact__value--email { overflow-wrap: anywhere; }
.contact__value[href^="tel:"] { white-space: nowrap; }
.contact :focus-visible { outline-color: var(--color-white); }
.contact .btn { justify-self: start; }

@media (min-width: 768px) {
  .contact { padding: var(--space-7); }
  .contact__list { grid-template-columns: auto auto; justify-content: start; column-gap: var(--space-8); }
}
@media (min-width: 1024px) {
  .contact {
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-8);
  }
  .contact .btn { grid-column: 2; }
}
@media (min-width: 1200px) {
  .contact { grid-template-columns: 300px minmax(0, 1fr) auto; column-gap: var(--space-6); }
  .contact .btn { grid-column: auto; justify-self: end; }
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: var(--space-6);
  border-top: 1px solid var(--color-line);
  background: var(--color-white);
}
.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
  font-size: var(--fs-small);
  color: var(--color-muted);
}
.mascot { width: 84px; height: auto; aspect-ratio: 844 / 1092; }
.site-footer__name { font-weight: 600; color: var(--color-navy); }

@media (min-width: 640px) {
  .site-footer__inner { flex-direction: row; text-align: left; gap: var(--space-5); }
}

/* ---------- Thanh liên hệ nhanh (chỉ mobile) ---------- */
.quickbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--color-line);
  box-shadow: 0 -6px 20px -12px rgba(20, 35, 70, 0.25);
  transition: transform 200ms ease, visibility 200ms;
}
.quickbar.is-hidden { transform: translateY(100%); visibility: hidden; }

.quickbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  border-radius: 10px;
  border: 1px solid rgba(30, 55, 105, 0.35);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--color-navy);
  text-decoration: none;
}
.quickbar__btn--primary { background: var(--color-navy); border-color: var(--color-navy); color: var(--color-white); }

/* Chừa chỗ để thanh cố định không che footer */
body { padding-bottom: calc(var(--quickbar-h) + env(safe-area-inset-bottom, 0px)); }

@media (min-width: 768px) {
  .quickbar { display: none; }
  body { padding-bottom: 0; }
}

/* ---------- Giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .mascot { display: none; }   /* không có bản tĩnh của GIF nên ẩn đi */
}

/* ---------- In ấn ---------- */
@media print {
  .site-header, .quickbar, .actions, .contact .btn, .mascot, .skip-link { display: none !important; }
  body { padding: 0; }
  .contact { background: none; color: var(--color-text); border: 1px solid var(--color-line); }
  .contact__value { color: var(--color-text); }
}
