/* CSS Variables */
:root {
  --primary: #c49a6c;
  --primary-dark: #b38a5c;
  --background: #f4e7da;
  --text: #3b2f2f;
  --footer: #2b1e1e;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--background);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@font-face {
  font-family: 'Poppins';
  font-display: swap;
}

header {
  background: linear-gradient(to right, #d9b99b, #e6c7aa, #d9b99b);
  padding: 25px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  position: relative;
  border-bottom: 2px solid rgba(139, 97, 62, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c49a6c' fill-opacity='0.08' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
  z-index: -1;
}

.logo {
  width: 80px;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

nav {
  background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
  padding: 14px 12px;
  width: 100%;
  transition: all 0.3s ease;
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom: 2px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  z-index: 5;
  will-change: transform;
  transform: translateZ(0);
}

nav.sticky {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  width: 100%;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 60px;
}

nav ul li a {
  color: white;
  text-decoration: none;
  font-weight: bold;
  font-size: 18px;
  display: inline-block;
  padding: 10px 20px;
  position: relative;
  transition: color 0.3s ease;
  overflow: hidden;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #ffffff;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease-in-out;
}

nav ul li a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

nav ul li a:hover {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  -webkit-animation: bounce 0.4s ease;
  animation: bounce 0.4s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) translateZ(0); }
  50% { transform: translateY(-5px) translateZ(0); }
}

.hamburger {
  display: none;
  cursor: pointer;
  font-size: 30px;
  color: white;
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  padding: 5px;
}

main {
  flex: 1;
  text-align: center;
  margin-top: 30px;
  padding-bottom: 100px;
}

section:not(:first-child) {
  content-visibility: auto;
  contain-intrinsic-size: 1px 1000px;
}

/* Horizontal divider between sections */
#welcome + #settings {
  border-top: 1px solid var(--primary);
  padding-top: 20px;
  margin-top: 20px;
}

footer {
  background: var(--footer);
  color: white;
  text-align: center;
  padding: 15px 10px;
  position: relative;
  width: 100%;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
}

h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

p {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
}

nav ul li a:focus {
  outline: none;
}

@media print {
  nav, footer, .hamburger {
      display: none;
  }
  
  body {
      background: white;
      color: black;
  }
  
  main {
      margin: 0;
      padding: 0;
  }
}

@media (min-width: 469px) and (max-width: 1024px) {
  body {
      padding: 0 15px;
  }
  
  .hamburger {
      display: block;
      font-size: 28px;
      right: 25px;
  }
  
  nav ul {
      display: none;
      flex-direction: column;
      gap: 10px;
      margin-top: 10px;
  }
  
  nav.mobile-active ul {
      display: flex;
  }
  
  nav ul li {
      margin: 10px 0;
  }
  
  header {
      padding: 15px;
  }
  
  nav ul li a {
      font-size: 16px;
      padding: 10px 15px;
  }
  
  main {
      margin-top: 15px;
      padding-bottom: 80px;
  }
  
  footer {
      padding: 8px;
      font-size: 0.9rem;
  }
}

@media (max-width: 468px) {
  body {
      padding: 0 6px;
  }
  
  .hamburger {
      display: block;
      font-size: 28px;
      right: 12px;
  }
  
  /* Critical fix for mobile layout */
  header, nav, main, footer {
      margin-left: 6px;
      margin-right: 6px;
      width: calc(100% - 12px);
      box-sizing: border-box;
  }
  
  nav.sticky {
      margin-left: 0;
      margin-right: 0;
      padding-left: 12px;
      padding-right: 12px;
      width: 100%;
  }
  
  nav ul {
      display: none;
      flex-direction: column;
      gap: 8px;
      margin-top: 10px;
  }
  
  nav.mobile-active ul {
      display: flex;
  }
  
  nav ul li {
      margin: 8px 0;
  }
  
  header {
      padding: 10px;
  }
  
  nav ul li a {
      font-size: 16px;
      padding: 10px 15px;
  }
  
  main {
      margin-top: 10px;
      padding-bottom: 60px;
  }
  
  footer {
      padding: 6px;
      font-size: 0.8rem;
  }
}