@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&family=Source+Sans+3:wght@200..900&display=swap');

@font-face {
  font-family: 'Chillax-Variable';
  src: url('/fonts/Chillax-Variable.woff2') format('woff2'),
    url('/fonts/Chillax-Variable.woff') format('woff'),
    url('/fonts/Chillax-Variable.ttf') format('truetype');
}

:root {
  --red: #ff0000;
  --bg: #ffffff;
  --text: #ff0000;
  --subtext: #333333;
  --card-bg: #ffffff;
  --card-border: #f0f0f0;
  --btn-text: #ffffff;
  --btn-bg: #ff0000;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #ff0000;
    --subtext: #cccccc;
    --card-bg: #111111;
    --card-border: #333333;
  }
}

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

html {
  background-color: var(--bg, #ffffff);
  min-height: 100dvh;
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  color-scheme: light dark;
}

body {
  background-color: var(--bg, #ffffff);
  min-height: 100dvh;
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  position: relative;
}

/* New Floating "Island" Header */
header {
  font-family: "Chillax-Variable", sans-serif;

  /* Positioning to make it float */
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;

  /* Sizing */
  width: auto;
  max-width: 90%;
  min-width: 320px;
  padding: 0.8rem 2rem;

  /* Visuals - Glass Pill Style */
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 100px;
  /* Full rounded corners */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);

  /* Layout */
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;

  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dynamic resize on scroll could be added with JS, 
   but this hover effect mimics interaction */
header:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
  transform: translateX(-50%) translateY(-2px);
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: #000;
  text-decoration: none;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  margin: 0;
}

nav a {
  text-decoration: none;
  color: #444;
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  transition: color 0.3s;
}

nav a:hover {
  color: #cc0000;
}

/* Minimal Dot Indicator on Hover */
nav a::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: #cc0000;
  border-radius: 50%;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

nav a:hover::after {
  transform: translateX(-50%) scale(1);
}

/* Hamburger Menu - Hidden on Desktop */
#hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 6px;
  padding: 5px;
  z-index: 10001;
}

#hamburger-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: #000;
  transition: all 0.3s ease;
}

/* Mobile Responsiveness */
@media (max-width: 700px) {
  header {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem 1.5rem;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    /* More solid on mobile */
  }

  /* Disable hover effect on mobile */
  header:hover {
    transform: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  }

  #hamburger-btn {
    display: flex;
  }

  /* Premium Full-Screen Overlay Menu */
  nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10000;
    /* Behind hamburger button */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2rem;
  }

  header.mobile-nav-open nav {
    opacity: 1;
    pointer-events: all;
    max-height: 100vh;
    /* Override previous max-height */
    margin-top: 0;
    padding-top: 2rem;
    border-top: none;
  }

  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    width: 100%;
  }

  nav a {
    font-family: "Chillax-Variable", "IBM Plex Sans Thai", sans-serif;



    /* Typography */
    font-size: 2rem;
    /* Large Typography */
    font-weight: 600;
    white-space: nowrap;
    color: #000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease,
      transform 0.4s ease;
  }

  /* Staggered Animation for Links */
  header.mobile-nav-open nav a {
    opacity: 1;
    transform: translateY(0);
  }

  header.mobile-nav-open nav li:nth-child(1) a {
    transition-delay: 0.1s;
  }

  header.mobile-nav-open nav li:nth-child(2) a {
    transition-delay: 0.2s;
  }

  header.mobile-nav-open nav li:nth-child(3) a {
    transition-delay: 0.3s;
  }

  header.mobile-nav-open nav li:nth-child(4) a {
    transition-delay: 0.4s;
  }

  /* Hide the dot indicator on mobile for a cleaner look */
  nav a::after {
    display: none;
  }

  .brand {
    font-size: 1.2rem;
    z-index: 10002;
    /* Ensure brand is above overlay if needed, or keep it below */
    position: relative;
  }

  /* Hamburger Animation when Open */
  /* Hamburger Animation when Open */
  header.mobile-nav-open #hamburger-btn span:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
  }

  header.mobile-nav-open #hamburger-btn span:nth-child(2) {
    transform: translateY(-4px) rotate(-45deg);
  }
}

@media (prefers-color-scheme: dark) {
  /* On mobile, make header with blur but semi-transparent background */
  @media (max-width: 700px) {
    header {
      background: rgba(0, 0, 0, 0.3) !important;
      backdrop-filter: blur(20px) !important;
      -webkit-backdrop-filter: blur(20px) !important;
      border: none !important;
      box-shadow: none !important;
    }

    header:hover {
      background: rgba(0, 0, 0, 0.4) !important;
    }
  }

  /* Desktop dark mode */
  @media (min-width: 701px) {
    header {
      background: rgba(20, 20, 20, 0.8);
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    header:hover {
      background: rgba(255, 255, 255, 0.16);
      box-shadow: 0 15px 50px rgba(255, 255, 255, 0.15);
    }
  }

  header:hover .brand {
    color: #ffffff;
  }

  header:hover nav a {
    color: #ffffff;
  }

  header:hover nav a:hover {
    color: #cc0000;
  }

  header:hover #hamburger-btn span {
    background-color: #000;
  }

  /* Ensure X is visible on dark overlay even when hovered */
  header.mobile-nav-open #hamburger-btn span,
  header.mobile-nav-open:hover #hamburger-btn span {
    background-color: #fff;
  }

  .brand {
    color: #fff;
  }

  nav a {
    color: #ccc;
  }

  nav a:hover {
    color: #fff;
  }

  nav a::after {
    background: #ff3333;
  }

  #hamburger-btn span {
    background-color: #fff;
  }

  header.mobile-nav-open nav {
    border-top: none;
  }

  @media (max-width: 700px) {
    nav {
      background: rgba(0, 0, 0, 0.95);
    }

    nav a {
      color: #fff;
    }
  }
}

/* Global Font Settings */
body {
  font-family: "Source Sans 3", "IBM Plex Sans Thai", sans-serif;
}

/* Headers & Brand - Chillax with Thai fallback */
h1,
h2,
h3,
h4,
h5,
h6,
.brand,
header,
.font-brand {
  font-family: "Chillax-Variable", "IBM Plex Sans Thai", sans-serif;
}

/* Thai Font Override Global - REMOVED */
/* The font stack above handles this automatically now. */