/* ==========================================================================
   Layout — Personal Portfolio
   Page structure, section containers, responsive grid.
   Requirements: 14.2
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base Reset & Box-Sizing
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  min-height: 100%;
  position: relative;
}

/* --------------------------------------------------------------------------
   Body
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  font-size: 1.0625rem;   /* 17px base — scales all em-based children */
  background-color: #FFFFFF;
  color: var(--color-text-primary);
  scroll-behavior: smooth;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: auto;
  overflow-y: auto;
}

/* --------------------------------------------------------------------------
   #intro — Luxury minimalist intro overlay
   Flat warm beige; removed from DOM after butterfly sequence completes.
   -------------------------------------------------------------------------- */
#intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #F5EBDD;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   #main-content — Primary content wrapper
   Sections stacked vertically.
   -------------------------------------------------------------------------- */
#main-content {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  width: 100%;
  padding-top: 70px; /* Space for fixed nav */
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease;
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Section — Base layout
   Consistent vertical rhythm; centered content with max-width container.
   -------------------------------------------------------------------------- */
section {
  padding-top: var(--space-4xl);
  padding-bottom: var(--space-4xl);
  padding-inline: var(--space-xl);
  max-width: 1200px;
  margin-inline: auto;
  width: 100%;
}

/* --------------------------------------------------------------------------
   #hero — Full-viewport landing section
   -------------------------------------------------------------------------- */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: visible;
  /* Override section max-width so background can be full-width */
  max-width: none !important;
  width: 100%;
  padding-inline: var(--space-xl);
  padding-bottom: 2rem;
  margin: 0 !important;
}

/* Full-width background layer for hero only */
#hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  min-width: 100%;
  height: 100%;
  background: #f5ede0;
  z-index: -1;
}

#hero .hero-content {
  max-width: 1200px;
  width: 100%;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: flex-end;
  padding-bottom: var(--space-xl);
}

.hero-bottom-bar {
  max-width: 1200px;
  width: 100%;
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   #about — About card (flex row)
   -------------------------------------------------------------------------- */
#about .about-card {
  display: flex;
  gap: var(--space-2xl);
  flex-wrap: wrap;
  align-items: center;
  background: var(--color-beige-100);
  border-radius: var(--radius-card);
  padding: var(--space-2xl);
}

/* --------------------------------------------------------------------------
   #skills — Skills grid (wrapping flex)
   -------------------------------------------------------------------------- */
#skills .skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* --------------------------------------------------------------------------
   #projects — Projects grid (auto-fill responsive grid)
   -------------------------------------------------------------------------- */
#projects .projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
}

/* --------------------------------------------------------------------------
   nav — Fixed navigation bar (always at top)
   -------------------------------------------------------------------------- */
nav {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 10000 !important;
  background: rgba(250, 247, 242, 0.95) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(30, 20, 16, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
  opacity: 1;
  visibility: visible;
  display: block;
}

nav.scrolled {
  background: rgba(250, 247, 242, 0.98) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   Scroll margin — compensate for sticky nav height
   -------------------------------------------------------------------------- */
section {
  scroll-margin-top: 100px;
}

#hero {
  scroll-margin-top: 80px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer {
  text-align: center;
  padding: var(--space-xl);
  background: #6B4226;
  color: #FFFFFF;
  font-size: var(--size-sm);
  border-top: none;
}

/* --------------------------------------------------------------------------
   Responsive — Mobile (<768px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  section {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
    padding-inline: var(--space-md);
  }

  #hero {
    padding-inline: var(--space-md);
    min-height: 100svh; /* Use svh on mobile to account for browser chrome */
    padding-bottom: 1.5rem;
  }

  .hero-bottom-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  #about .about-card {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-lg);
    gap: var(--space-lg);
  }

  #projects .projects-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}


/* ==========================================================================
   UNIFIED LAYOUT - Consistent spacing and alignment
   ========================================================================== */

body {
  background: #FFFFFF !important;
}

/* All sections: KHOẢNG CÁCH NHỎ giữa các sections */
section,
#hero,
#about,
#experience,
#skills,
#projects,
#contact,
#gallery,
#mammy-results,
.exp-edu-section,
.skills-section,
.services-section {
  background: #FFFFFF !important;
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-top: 1.5rem !important;
  padding-bottom: 1.5rem !important;
}

/* Sticky cards container */
.sticky-cards {
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}


/* --------------------------------------------------------------------------
   #about — About section with full-width title background
   -------------------------------------------------------------------------- */
#about {
  position: relative;
}

/* Full-width background for About title */
.about-title-wrapper {
  position: relative;
}

.about-title-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  min-width: 100%;
  height: 100%;
  background: #e8dcc8;
  z-index: -1;
}
