/* ===========================
   WRAPPER STRUCTURE
=========================== */

#wrapper {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: auto;
  padding: 20px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  box-shadow:
    0 4px 12px rgba(44,40,37,0.09),
    0 16px 40px rgba(44,40,37,0.13),
    0 2px 6px rgba(44,40,37,0.06);
}

#wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  pointer-events: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.75),
    inset 0 -1px 0 rgba(44,40,37,0.05);
}

#wrapper::after,
.container::after,
#wrapper main::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: calc(var(--radius) + 2px);
  pointer-events: none;
  filter: blur(6px);
  opacity: 0.32;
}

.container,
#wrapper main {
  position: relative;
  max-width: 900px;
  margin: auto;
  padding: 20px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  box-shadow:
    0 4px 12px rgba(44,40,37,0.09),
    0 16px 40px rgba(44,40,37,0.13),
    0 2px 6px rgba(44,40,37,0.06);
}

/* ===========================
   MAIN LAYOUT
=========================== */

main {
  position: relative;
  z-index: 1;
  background: transparent;
  box-shadow: none;
  animation: fadeUp 0.28s cubic-bezier(.4,0,.2,1);
}

section {
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
  padding: 1.5rem;
  background: var(--surface-alt);
  border-radius: var(--radius);
  border: 1px solid rgba(44,40,37,0.06);
  opacity: 0;
  transform: translateY(10px);
  animation: sectionIn 0.28s cubic-bezier(.4,0,.2,1) forwards;
}

section:nth-of-type(1) { animation-delay: 0.02s; }
section:nth-of-type(2) { animation-delay: 0.04s; }
section:nth-of-type(3) { animation-delay: 0.06s; }
section:nth-of-type(4) { animation-delay: 0.08s; }

main section {
  margin-top: 2.2rem;
  margin-bottom: 2.2rem;
}

section > * + * {
  margin-top: 1rem;
}

section > h2 {
  position: relative;
  padding-bottom: .4rem;
}

section > h2::after {
  content: "";
  display: block;
  width: 36px;
  height: 2px;
  margin-top: .35rem;
  background: var(--accent);
  border-radius: 2px;
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  padding: 80px 20px 2rem;
  margin-bottom: 2.5rem;
}

.hero + section {
  margin-top: 3rem;
}

.hero::after {
  content: "";
  position: absolute;
  left: -1.5rem;
  right: -1.5rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(44,40,37,0.10),
    transparent
  );
}

.hero .chips {
  margin-top: .25rem;
}

.hero .action-button {
  margin-top: .75rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.grid .card {
  margin: 0;
  max-width: none;
}

.projects-grid,
.contact-grid {
  display: grid;
  gap: 25px;
}

/* ===========================
   GLOBAL LAYER ORDER
=========================== */

nav.menu {
  position: relative;
  z-index: 100;
}

.menu-links {
  position: relative;
  z-index: 200;
}

.back-to-top,
.back-nav,
#toggle-dark {
  z-index: 80;
}

/* ===========================
   FOOTER
=========================== */

footer {
  margin-top: 1.5rem;
  padding: 18px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
}

.dark-mode main,
.dark-mode footer,
.dark-mode .menu,
.dark-mode .project-switcher {
  background: var(--surface);
}

body.dark-mode section {
  background:
    linear-gradient(
      145deg,
      rgba(32,54,71,0.58),
      rgba(23,37,50,0.50)
    );
  box-shadow: 0 25px 60px rgba(0,0,0,.45);
  border: 1px solid rgba(187,216,233,.10);
}

/* ===========================
   DESKTOP LAYOUT
=========================== */

@media (min-width: 700px) {
  main {
    margin-top: 2.5rem;
  }

  main::before {
    content: "";
    display: block;
    height: 1px;
    width: 100%;
    background: rgba(44,40,37,0.07);
    margin-bottom: 2rem;
  }

  nav.menu {
    margin-bottom: 3.5rem;
  }

  .hamburger-menu {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    width: 100%;
    margin-bottom: 2.5rem;
  }

  .site-name {
    margin-left: 0.75rem;
    justify-self: start;
    align-self: center;
  }

  .social-icons {
    margin-right: 0.75rem;
    justify-self: end;
    align-self: center;
  }
}

body:not(.dark-mode) #wrapper {
  background:
    linear-gradient(
      180deg,
      rgba(238,230,218,0.58),
      rgba(224,215,202,0.50)
    );

  border: 1px solid rgba(255,255,255,0.24);

  box-shadow:
    0 6px 16px rgba(44,40,37,0.12),
    0 24px 55px rgba(44,40,37,0.18),
    inset 0 1px 0 rgba(255,255,255,0.42);

}

body:not(.dark-mode) #wrapper::after,
body:not(.dark-mode) .container::after,
body:not(.dark-mode) #wrapper main::after {
  background: rgba(255,255,255,0.34);
}

body.dark-mode #wrapper {
  background:
    linear-gradient(
      180deg,
      rgba(32,54,71,0.58),
      rgba(23,37,50,0.50)
    );

  border: 1px solid rgba(187,216,233,0.10);

  box-shadow:
    0 8px 18px rgba(0,0,0,0.28),
    0 28px 60px rgba(0,0,0,0.34),
    inset 0 1px 0 rgba(187,216,233,0.025);

}

body:not(.dark-mode) #wrapper main,
body:not(.dark-mode) .container {
  background:
    linear-gradient(
      180deg,
      rgba(246,240,230,0.38),
      rgba(230,222,209,0.32)
    );
  border: 1px solid rgba(255,255,255,0.20);
}

body.dark-mode #wrapper main,
body.dark-mode .container {
  background:
    linear-gradient(
      180deg,
      rgba(32,54,71,0.38),
      rgba(23,37,50,0.32)
    );
  border: 1px solid rgba(187,216,233,0.08);
  box-shadow:
    0 8px 18px rgba(0,0,0,0.24),
    0 24px 54px rgba(0,0,0,0.30),
    inset 0 1px 0 rgba(187,216,233,0.025);
}

body.dark-mode #wrapper::before {
  box-shadow:
    inset 0 1px 0 rgba(187,216,233,0.055),
    inset 0 -1px 0 rgba(0,0,0,0.18);
}

body.dark-mode #wrapper::after,
body.dark-mode .container::after,
body.dark-mode #wrapper main::after {
  background: rgba(43,74,94,0.34);
  opacity: 0.34;
}

body:not(.dark-mode) section {
  background:
    linear-gradient(
      145deg,
      rgba(246,240,230,0.58),
      rgba(230,222,209,0.50)
    );

  border: 1px solid rgba(255,255,255,0.28);

  box-shadow:
    0 4px 10px rgba(44,40,37,0.10),
    0 18px 42px rgba(44,40,37,0.15),
    inset 0 1px 0 rgba(255,255,255,0.38);

}

/* ===========================
   RESPONSIVE LAYOUT
=========================== */

@media (max-width: 768px) {
  #wrapper {
    padding: 1.25rem 1rem;
  }

  main,
  section {
    padding: 1.25rem;
  }


}
