/*
  Tran Nhat Tan — Online CV Styles
  - Modern, clean, responsive
  - Palette: white background, primary #2c3e50, accent #2980b9
*/

:root {
  --color-bg: #ffffff;
  --color-text: #2b2b2b;
  --color-muted: #6b7280;
  --color-primary: #2c3e50;
  --color-accent: #2980b9;
  --color-card: #f8fafc;
  --color-border: #e5e7eb;
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --header-height: 56px;
  --tag-bg: #eef6fb;
  --tag-text: #0f5f8c;
  --tag-border: #d8ecf8;
  color-scheme: light;
  /* Dark theme tokens */
  --d-bg: #0e141b;
  --d-text: #e5e7eb;
  --d-muted: #9ca3af;
  --d-primary: #e6edf3;
  --d-accent: #3b82f6;
  --d-card: #111827;
  --d-border: #1f2937;
  --d-tag-bg: #122233;
  --d-tag-text: #9cc9ff;
  --d-tag-border: #1f3b57;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  transition: background-color 200ms ease, color 200ms ease;
}

/* Dark mode */
:root[data-theme="dark"] {
  --color-bg: var(--d-bg);
  --color-text: var(--d-text);
  --color-muted: var(--d-muted);
  --color-primary: var(--d-primary);
  --color-accent: var(--d-accent);
  --color-card: var(--d-card);
  --color-border: var(--d-border);
  --tag-bg: var(--d-tag-bg);
  --tag-text: var(--d-tag-text);
  --tag-border: var(--d-tag-border);
  color-scheme: dark;
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

/* Làm tròn tất cả ảnh avatar */
img[src*="avatar"], 
img[src*="logo"] {
  border-radius: 50%;
  object-fit: cover;
}

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

a:hover {
  text-decoration: underline;
}

/* In dark mode, ensure link contrast is sufficient */
[data-theme="dark"] a { color: var(--d-accent); }

.container {
  max-width: 1080px;
  padding: 0 16px;
  margin: 0 auto;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 8px 12px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 6px;
  z-index: 1000;
}

/* Header / Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--color-border);
  transition: background-color 200ms ease, border-color 200ms ease;
}

[data-theme="dark"] .site-header {
  background: rgba(14, 20, 27, 0.9);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  transition: height 200ms ease;
}

.brand { display: inline-flex; align-items: center; gap: 10px; line-height: 1.1; }
.brand__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--color-accent); }
.brand__info { display: flex; flex-direction: column; }
.brand__name { font-family: "Poppins", "Inter", sans-serif; font-weight: 700; color: var(--color-primary); letter-spacing: 0.2px; }
.brand__role { font-size: 12px; font-weight: 600; color: var(--color-accent); }

.nav-menu {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.nav-menu a {
  color: var(--color-primary);
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
}

.nav-menu a:hover {
  background: var(--color-card);
}

.nav-menu a.active {
  color: var(--color-accent);
  background: var(--color-card);
}

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}

.nav-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--color-border);
  background: transparent; color: var(--color-primary);
  cursor: pointer;
  transition: all 150ms ease;
}
.icon-btn:hover { background: var(--color-card); color: var(--color-accent); }

/* Ensure icons visible across themes */
.icon-btn i { font-size: 16px; line-height: 1; }
.icon-btn .icon-text { 
  font-size: 18px; 
  line-height: 1; 
  display: block; 
  font-weight: bold;
  font-family: monospace;
}
.btn i { line-height: 1; }

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
  position: relative;
  transition: transform 200ms ease, opacity 200ms ease;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

/* Mobile menu */
@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; }
  .nav-menu {
    position: fixed;
    inset: var(--header-height) 0 auto 0;
    background: var(--color-bg);
    box-shadow: var(--shadow-md);
    border-top: 1px solid var(--color-border);
    display: none;
    flex-direction: column;
    gap: 0;
  }
  .nav-menu li { border-bottom: 1px solid var(--color-border); }
  .nav-menu a { padding: 16px; display: block; }
  .nav-menu.open { display: flex; }
}

/* Hero */
/* Profile Hero Section */
.profile-hero {
  padding: 32px 0 24px;
  background: linear-gradient(135deg, var(--color-card) 0%, var(--color-bg) 100%);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 600px;
  margin: 0 auto;
  background: var(--color-bg);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.profile-avatar {
  flex-shrink: 0;
}

.avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--color-accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.profile-info {
  flex: 1;
}

.profile-name {
  margin: 0 0 8px;
  font-family: "Poppins", "Inter", sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.profile-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-accent);
}

.profile-location {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
}

/* Responsive profile */
@media (max-width: 600px) {
  .profile-card {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .avatar-large {
    width: 100px;
    height: 100px;
  }
  
  .profile-name {
    font-size: 24px;
  }
}

.contact-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 16px;
  padding: 0;
  margin: 0;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-muted);
}

.contact-list a { color: var(--color-primary); }
.contact-list i { color: var(--color-accent); }

/* Sections */
.section {
  padding: 56px 0;
  scroll-margin-top: calc(var(--header-height) + 16px); /* offset for sticky header */
}

.section--alt { background: var(--color-card); }

.section__title {
  font-family: "Poppins", "Inter", sans-serif;
  font-size: 26px;
  color: var(--color-primary);
  margin: 0 0 18px;
  position: relative;
}

.section__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 52px;
  height: 3px;
  background: var(--color-accent);
  border-radius: 2px;
}

.lead {
  margin-top: 18px;
  color: var(--color-text);
}

/* Education */
.edu-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
}

.edu-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edu-card__title {
  margin: 0;
  font-size: 18px;
}

.edu-card__period { color: var(--color-muted); }
.edu-card__meta { color: var(--color-muted); }

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.skill-group {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
}

.skill-group__title {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--color-primary);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--tag-border);
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.project-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-md);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.project-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.project-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-card__title { margin: 0; font-size: 18px; color: var(--color-primary); }
.project-card__meta { color: var(--color-muted); }

.project-card__desc {
  margin: 12px 0 10px;
  padding-left: 18px;
}

.project-card__stack { display: flex; flex-wrap: wrap; gap: 8px; }

.project-card__links { margin-top: 12px; display: flex; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-weight: 600;
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.btn--ghost:hover { background: var(--color-card); }
.btn--primary {
  background: var(--color-accent);
  color: #ffffff;
  border-color: transparent;
}
.btn--primary:hover { filter: brightness(0.95); }

/* Ensure primary button text is always readable */
:root[data-theme="dark"] .btn--primary {
  color: #ffffff;
  background: var(--color-accent);
}
.btn:active { transform: translateY(1px); }

/* Certificates */
.cert-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.cert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 16px;
}

.cert-item__title { margin: 0; font-size: 16px; color: var(--color-primary); }
.cert-item__meta { margin: 4px 0 0; color: var(--color-muted); }

.cert-item__link {
  font-weight: 600;
  color: var(--color-accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 20px 0;
  margin-top: 16px;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer__social { display: flex; gap: 12px; }
.footer__social a { color: var(--color-primary); transition: transform 120ms ease, color 160ms ease; }
.footer__social a:hover { color: var(--color-accent); transform: translateY(-1px); }

/* Reveal-on-scroll animation (light) */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 500ms ease, transform 500ms ease; }
.reveal.visible { opacity: 1; transform: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; }
  .project-card { transition: none; }
}

/* Shrink header after scrolling */
.site-header.shrink { --header-height: 52px; }

@media (max-width: 600px) {
  .hero__title { font-size: 30px; }
}

/* Print basics */
@media print {
  .site-header, .nav-toggle, .nav-menu, .site-footer { display: none !important; }
  .section { padding: 0; }
}

/* Form */
.contact-form { margin-top: 18px; display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-field { display: grid; gap: 6px; }
.form-field input, .form-field textarea {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-bg); color: var(--color-text);
}
.form-actions { display: flex; align-items: center; gap: 12px; }
.form-hint { color: var(--color-muted); font-size: 14px; }
.form-status { color: var(--color-accent); font-weight: 600; min-height: 20px; }

@media (max-width: 700px) {
  .form-row { grid-template-columns: 1fr; }
}

/* Map */
.map-embed { 
  margin-top: 16px; 
  border-radius: 12px; 
  overflow: hidden; 
  border: 1px solid var(--color-border);
  transition: filter 300ms ease;
}
.map-embed iframe { width: 100%; height: 260px; border: 0; display: block; }

/* Dark mode map filter */
:root[data-theme="dark"] .map-embed {
  filter: invert(90%) hue-rotate(180deg);
}

