/* Reset */
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

:root {
  --primarycolor: rgb(0, 0, 0);
  --primary-bg-color: #ffffff;
  --primary-bs-color: rgba(0, 0, 0, 0.15);
  --font-size-base: 16px;
  --border-radius-base: 12px;
  --boxshadow-base: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Common */
html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  line-height: 1.5;
}

body {
  font-family: "Montserrat", sans-serif;
}

h2 {
  font-weight: bold;
  font-size: 2rem;
}

h3 {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 20px;
}

li {
  list-style: none;
}

a {
  text-decoration: none;
}

p {
  color: #555;
}

ul {
  list-style: none;
}

.section-spacer {
  padding: 5.2rem 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.btn-primary {
  display: inline-block;
  padding: 12px 28px;
  background: var(--primarycolor);
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-weight: 600;
  transition: 0.25s ease;
  text-align: center;
}

.btn-primary:hover {
  background: #606163;
  transform: translateY(-3px);
}

.error {
  color: red;
  font-size: 0.8rem;
  margin-top: 4px;
}

/* Header Section */
header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: 0.3s ease-in-out;
}

.hidden {
  transform: translateY(-100%); /* Đẩy header lên phía trên khuất màn hình */
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.header-avatar {
  display: flex;
  align-items: center;
}

.header-avatar img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  animation: slideFromLeft 1s ease-out forwards;
}

/* --- NHÓM ACTIONS MOBILE --- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-login-icon {
  color: #000;
  display: flex;
  align-items: center;
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.hamburger-btn .bar {
  width: 25px;
  height: 2px;
  background: #000;
  transition: 0.3s ease;
}

/* --- MENU MOBILE (HIDDEN BY DEFAULT) --- */
.header-nav {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #fff;
  max-height: 0;
  overflow: hidden; /* Ẩn nội dung thừa*/
  transition: max-height 0.4s ease-in-out;
  box-shadow: var(--boxshadow-base);
}

.header-nav ul {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 2rem;
  gap: 1.2rem;
}

.header-nav a {
  color: #333;
  font-weight: 500;
  font-size: 1.1rem;
}

@keyframes slideFromLeft {
  0% {
    opacity: 0;
    transform: translateX(-50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideFromRight {
  0% {
    opacity: 0;
    transform: translateX(50px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideFromTop {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes opacity {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- LOGIC ĐÓNG MỞ (CHECKBOX HACK) --- */
#menu-cb:checked ~ .header-nav {
  max-height: 500px;
}

/* Hiệu ứng xoay nút Hamburger thành dấu X */
#menu-cb:checked ~ .hamburger-btn .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

#menu-cb:checked ~ .hamburger-btn .bar:nth-child(2) {
  opacity: 0;
}

#menu-cb:checked ~ .hamburger-btn .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.pc-only {
  display: none;
}

@media (min-width: 768px) {
  .mobile-login-icon,
  .hamburger-btn {
    display: none;
  }

  .header {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .header-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
  }

  .pc-only {
    display: inline-block;
    animation: slideFromRight 1s ease-out forwards;
  }

  .header-nav {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    box-shadow: none;
  }

  .header-nav ul {
    flex-direction: row;
    gap: 2rem;
    padding: 0;
  }

  .header-nav ul li {
    animation: slideFromTop 0.8s ease-out forwards;
  }

  .header-nav ul li:nth-child(1) {
    animation-delay: 0.1s;
  }
  .header-nav ul li:nth-child(2) {
    animation-delay: 0.2s;
  }
  .header-nav ul li:nth-child(3) {
    animation-delay: 0.3s;
  }
  .header-nav ul li:nth-child(4) {
    animation-delay: 0.4s;
  }
  .header-nav ul li:nth-child(5) {
    animation-delay: 0.5s;
  }

  .header-nav a {
    font-size: 1rem;
    transition: 0.2s;
  }

  .header-nav a:hover {
    color: var(--primarycolor);
    font-weight: 600;
  }
}

/* Main Section */
/* Hero Banner Section */
/* ============================
   HERO BANNER
============================ */
.hero-banner {
  height: calc(100vh - 60px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 1.75rem;
}

.hero-banner h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  animation: opacity 1.3s ease-out forwards;
}

.hero-subtitle {
  max-width: 90%;
  opacity: 0.8;
  animation: opacity 1.3s ease-out forwards;
}

.hero-socials {
  display: flex;
  gap: 1.25rem;
  margin: 1rem 0;
}

.media-icon {
  color: #000;
  display: inline-flex;
  padding: 0.7rem;
  border-radius: 50%;
  transition: 0.3s ease;
  background-color: #dbdddf;
  position: relative;
  z-index: 100;
}

.follow-count {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: rgb(0, 0, 0);
  border-radius: 10px;
  padding: 4px;
  font-size: 0.6rem;
  color: white;
}

.media-icon:hover {
  background-color: rgba(0, 0, 0, 0.08);
  transform: scale(1.2);
}

/* Hero Banner for Tablet */
@media (min-width: 768px) {
  .hero-banner {
    min-height: 85vh;
  }

  .hero-banner h1 {
    font-size: 2.7rem;
    max-width: 800px;
  }
}

/* Hero Banner for PC */
@media (min-width: 1024px) {
  .hero-banner {
    min-height: 100vh;
  }

  .hero-banner h1 {
    font-size: 3rem;
    max-width: 900px;
    transition: letter-spacing ease-in-out 0.3s;
  }
  .hero-banner h1:hover {
    letter-spacing: 0.1rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
    max-width: 500px;
    margin-bottom: 1rem;
  }
}

/* ------------ */
/* My Skills Section */
/* --- MY SKILLS MOBILE --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.skills-col {
  background: var(--primary-bg-color);
  padding: 1rem;
  border-radius: var(--border-radius-base);
  height: 100%;
  overflow: hidden; /* Ẩn nội dung thừa*/
  box-shadow: var(--boxshadow-base);
}

.skills-col h3 {
  margin-bottom: 1rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.5rem;
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}

.skill-icon {
  width: 25px;
  height: 25px;
  object-fit: contain; /* Ép ảnh có kích thước 25px -25px*/
}

@media (min-width: 768px) {
  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .skills-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .skills-col {
    transition: 0.3s ease;
  }

  .skill-icon {
    width: 35px;
    height: 35px;
  }

  .skills-col:hover {
    transform: translateY(-8px);
    box-shadow: var(--boxshadow-base);
  }
}

/* My Projects Section */
/* --- MY PROJECTS MOBILE FIRST --- */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

.card {
  background: #ffffff;
  border-radius: var(--border-radius-base);
  overflow: hidden;
  box-shadow: var(--boxshadow-base);
  display: flex;
  flex-direction: column;
  transition: 0.3s ease;
}

.card__img-wrapper {
  width: 100%;
  height: 250px;
  overflow: hidden;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.card__img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: 0.3s ease;
}

.card__img:hover {
  transform: scale(1.2);
  object-fit: cover;
}

.card__content {
  padding: 1.25rem;
}

.card__btn {
  padding: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .card:hover {
    transform: translateY(-5px);
    box-shadow: var(--boxshadow-base);
  }
}

/* ---------------- */
/* About Me Section */
/* --- ABOUT ME MOBILE & TABLET (MẶC ĐỊNH) --- */
.about-me-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
}

.about-me__img {
  width: 100%;
  flex: 1;
}

.about-me__img img {
  width: 100%;
  height: auto;
  object-fit: cover;
  box-shadow: 0 4px 15px var(--primary-bs-color);
  border-radius: var(--border-radius-base);
}

.about-me__content {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.about-me__content p {
  text-align: justify;
}

@media (min-width: 1024px) {
  .about-me-container {
    flex-direction: row;
    align-items: flex-start;
    gap: 4rem;
  }
}

/* Contact Me Section */
.contact-me-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.contact-me-form {
  width: 100%;
  max-width: 500px;
  background: #fff;
  padding: 1.8rem;
  border-radius: var(--border-radius-base);
  box-shadow: 0 8px 30px var(--primary-bs-color);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-control {
  display: flex;
  flex-direction: column;
}

.form-control label {
  margin-bottom: 6px;
  font-weight: 500;
}

.form-control input,
.form-control textarea {
  padding: 12px 14px;
  border-radius: var(--border-radius-base);
  border: 1px solid #ccc;
}

.form-control input:focus,
.form-control textarea:focus {
  outline: none; /* Ẩn đường viền mặc định của Trình Duyệt*/
  border-color: var(--primarycolor);
}

@keyframes flash {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

.btn-contact-me {
  animation: flash 1.3s linear infinite;
}

/* Footer Section */
.footer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 3rem 0;
}

.footer__nav ul {
  display: flex;
  gap: 1.1rem;
}

.footer a {
  color: var(--primarycolor);
}

/* Btn */
.btn-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--primarycolor);
  color: var(--primary-bg-color);
  font-size: 18px;
  cursor: pointer;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
}
