/* Variables & Reset */
:root {
  /* Primary Color Components - Change these three values to change the entire theme */
  --primary-h: 216;
  --primary-s: 35%;
  --primary-l: 67%;
  
  /* All theme colors derive from the primary components above */
  --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
  --primary-hover: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) - 10%));
  --primary-light: hsl(var(--primary-h), var(--primary-s), 82%);
  --bg-accent-light: hsl(var(--primary-h), var(--primary-s), 96%);
  
  /* Neutral colors - Light Mode - derived from primary hue */
  --bg-body: hsl(var(--primary-h), 10%, 98%);
  --bg-alt: hsl(var(--primary-h), 15%, 96%);
  
  --text-main: hsl(var(--primary-h), 10%, 10%);
  --text-muted: hsl(var(--primary-h), 8%, 35%);
  --text-light: hsl(var(--primary-h), 6%, 45%);
  
  --border-color: hsl(var(--primary-h), 12%, 90%);
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  
  /* Reduced container width for better readability on laptops */
  --container-width: 960px; 
  --nav-height: 70px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark Mode - Automatically derived from primary colors */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Dark mode primary colors - automatically adjusted */
    --primary: hsl(var(--primary-h), var(--primary-s), 75%);
    --primary-hover: hsl(var(--primary-h), var(--primary-s), 85%);
    --primary-light: hsl(var(--primary-h), var(--primary-s), 45%);
    --bg-accent-light: hsl(var(--primary-h), var(--primary-s), 15%);
    
    /* Dark mode neutral colors - derived from primary hue */
    --bg-body: hsl(var(--primary-h), 15%, 8%);
    --bg-alt: hsl(var(--primary-h), 12%, 12%);
    
    --text-main: hsl(var(--primary-h), 10%, 95%);
    --text-muted: hsl(var(--primary-h), 8%, 75%);
    --text-light: hsl(var(--primary-h), 6%, 60%);
    
    --border-color: hsl(var(--primary-h), 10%, 25%);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  }
}

/* Manual dark mode override (when user clicks toggle) */
:root[data-theme="dark"] {
  /* Dark mode primary colors - automatically adjusted */
  --primary: hsl(var(--primary-h), var(--primary-s), 75%);
  --primary-hover: hsl(var(--primary-h), var(--primary-s), 85%);
  --primary-light: hsl(var(--primary-h), var(--primary-s), 45%);
  --bg-accent-light: hsl(var(--primary-h), var(--primary-s), 15%);
  
  /* Dark mode neutral colors - derived from primary hue */
  --bg-body: hsl(var(--primary-h), 15%, 8%);
  --bg-alt: hsl(var(--primary-h), 12%, 12%);
  
  --text-main: hsl(var(--primary-h), 10%, 95%);
  --text-muted: hsl(var(--primary-h), 8%, 75%);
  --text-light: hsl(var(--primary-h), 6%, 60%);
  
  --border-color: hsl(var(--primary-h), 10%, 25%);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-muted);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 {
  color: var(--text-main);
  line-height: 1.2;
  font-weight: 700;
}

h1 {
  font-size: 3rem;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}

h1 span {
  display: inline;
}

h2 {
  font-size: 2.25rem;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  text-align: justify;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

.highlight {
  color: var(--text-main);
  font-weight: 600;
  background: linear-gradient(120deg, transparent 0%, transparent 100%);
  background-repeat: no-repeat;
  background-size: 100% 40%;
  background-position: 0 88%;
  transition: background-size 0.2s ease;
}

/* Layout Utilities */
.container {
  width: 90%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: 5rem 0;
}

.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
    gap: 3rem; /* Increased gap for better separation */
  }
}

/* Navigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: color-mix(in srgb, var(--bg-body) 95%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  height: var(--nav-height);
  display: flex;
  align-items: center;
}

/* Fallback for browsers that don't support color-mix */
@supports not (background: color-mix(in srgb, white, black)) {
  .navbar {
    background-color: var(--bg-body);
    opacity: 0.95;
  }
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap; /* Prevent wrapping globally */
}

.logo span {
  color: var(--primary);
}

/* New Nav Pill Style */
.nav-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-accent-light);
  color: var(--primary);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--primary-light);
  white-space: nowrap;
}

.nav-pill-short {
  display: none;
}

.nav-links {
  display: none;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-btn {
  background-color: var(--primary);
  color: white !important;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.2s;
}

.nav-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

/* Updated Breakpoint: 1024px for Desktop Navigation */
@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
}

/* Hero Section */
.hero {
  padding: 6rem 0 4rem;
  background: radial-gradient(circle at top right, var(--bg-accent-light) 0%, transparent 40%);
}

.hero-content {
  max-width: 800px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: currentColor;
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--text-light);
  font-weight: 400;
  margin-bottom: 2rem;
}

.hero-subtitle strong {
  color: var(--text-main);
  font-weight: 600;
}

/* Mobile Buttons in Hero */
.mobile-hero-btns {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem; /* Reduced from 2rem for more compact mobile layout */
}

/* Hide hero buttons on Desktop (>= 1024px) */
@media (min-width: 768px) {
  .mobile-hero-btns {
    display: none; 
  }
}

/* Vision Section */
.vision-section {
  background-color: var(--bg-body);
}

.big-question {
  font-size: 1.5rem;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.5;
  margin: 2rem 0;
  padding: 2.5rem;
  background-color: var(--bg-alt);
  border-left: 5px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

/* About Section */
.about-section {
  background-color: var(--bg-alt);
}

.profile-card {
  background: var(--bg-body);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.profile-photo-wrapper {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  transform: scale(1.3) translateY(10%);
}

/* Join Section */
.join-section {
  background-color: var(--bg-body);
}

.opportunity-list {
  list-style: none;
  margin: 0;
}

.opportunity-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.opportunity-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

.cta-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background-color: var(--primary);
  color: white;
  font-weight: 600;
  padding: 1rem 2rem;
  border-radius: 8px;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
  text-align: center;
}

.cta-button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: white;
}

/* Box Styling for Join Section columns */
.info-box {
  padding: 2.5rem;
  border-radius: 12px;
  height: 100%;
}

.info-box-white {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.admission-alert {
  background-color: var(--bg-alt);
  border-left: 4px solid var(--text-light);
}

/* Style for the 'How to Join' box (greenish) */
.apply-box {
  background: var(--bg-accent-light);
  border: 1px solid var(--primary-light);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
}

.join-col-header {
  color: var(--primary);
  margin-bottom: 1rem;
}

/* Footer */
footer {
  padding: 3rem 0;
  background-color: var(--bg-body);
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
}

.theme-chooser-btn {
  margin-top: 10px;
  padding: 4px 10px;
  font-size: 11px;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-light);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  height: 28px;
  vertical-align: middle;
}

.theme-chooser-btn:hover {
  background-color: var(--bg-alt);
  color: var(--text-main);
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

.theme-chooser-btn:active {
  background-color: var(--bg-accent-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(0);
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
  margin-left: 8px;
  margin-top: 10px;
  padding: 4px 10px;
  font-size: 16px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  color: var(--primary);
  height: 28px;
}

.dark-mode-toggle:hover {
  background-color: var(--bg-alt);
  border-color: var(--primary-light);
  transform: translateY(-1px);
  color: var(--primary-hover);
}

.dark-mode-toggle:active {
  background-color: var(--bg-accent-light);
  border-color: var(--primary);
  transform: translateY(0);
}

.dark-mode-toggle .icon {
  transition: transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.dark-mode-toggle:hover .icon {
  transform: scale(1.1);
}

.dark-mode-toggle svg {
  display: block;
}

/* TABLET Navigation Adjustments (768px - 1023px) */
@media (max-width: 768px) {
  /* Center menu for Tablet and Phone */
  .nav-content { justify-content: center; }
  
  /* Tablet Hero Buttons Layout (Row) */
  .mobile-hero-btns {
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
  }
  
  .cta-button {
    /* Reset full width for tablets (it's set to 100% in phone media query below) */
    width: auto;
    margin-top: 0;
  }
}

/* PHONE Navigation & Layout (max-width: 768px) */
@media (max-width: 800px) {
  /* Reduce side padding for container to make it feel less narrow */
  .container { padding: 0 16px; width: 95%; } 
  
  /* Reduce navbar height on mobile */
  :root { --nav-height: 46px; }
  .navbar { height: 46px; }
  
  /* Mobile Hero Buttons Layout (Column) */
  .mobile-hero-btns {
    flex-direction: column;
    gap: 0.75rem; /* Reduced from 1rem */
  }
  
  h1 { 
    font-size: 2.25rem; /* Reduced from 2.5rem */
    text-align: center;
    
    /* Card/Frame Styling - more compact */
    background: color-mix(in srgb, var(--bg-body) 60%, transparent);
    backdrop-filter: blur(8px);
    border: 1px solid var(--primary-light);
    border-radius: 20px;
    padding: 1.1rem 1.75rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.25rem;
  }
  
  /* Fallback for browsers that don't support color-mix */
  @supports not (background: color-mix(in srgb, white, black)) {
    h1 {
      background: var(--bg-body);
      opacity: 0.95;
    }
  }

  /* Force 3-line breakdown for title on mobile with varying weights */
  h1 span {
    display: block;
    line-height: 1.05; /* Tighter line height */
  }
  
  h1 span:nth-child(1) { /* Efficient */
    font-weight: 300;
  }
  
  h1 span:nth-child(2) { /* Intelligence */
    font-weight: 300;
    margin: 0.2rem 0; /* Reduced from 0.25rem */
    color: var(--primary);
  }
  
  h1 span:nth-child(3) { /* Lab */
    font-weight: 300;
  }
  
  h2 { font-size: 1.75rem; }
  .big-question { font-size: 1.35rem; padding: 1.5rem; }
  .section { padding: 3rem 0; }
  .admission-alert, .apply-box, .info-box { padding: 1.5rem; }
  
  /* Navbar Improvements for Mobile */
  .logo { 
    font-size: 0.9rem; /* Reduced from 1.0rem to prevent wrapping on small screens */
    white-space: nowrap; /* Prevent wrapping */
  }
  .logo-area { gap: 0.5rem; }
  
  /* Show short pill, hide long pill */
  .nav-pill { display: none; }
  .nav-pill-short { 
    display: inline-flex;
    align-items: center;
    padding: 3px 6px; /* Slightly reduced padding */
    background: var(--bg-accent-light);
    color: var(--primary);
    border-radius: 9999px;
    font-size: 0.65rem; /* Slightly reduced font size */
    font-weight: 600;
    border: 1px solid var(--primary-light);
    white-space: nowrap;
  }
  
  /* Hero Improvements for Mobile - more compact */
  .hero { padding: 1.4rem 0 2rem; } /* Reduced significantly for mobile */
  .hero-subtitle { 
    font-size: 1.1rem; /* Reduced from 1.25rem */
    margin-bottom: 0.75rem; /* Reduce spacing */
  }
  
  /* Reduce paragraph spacing in hero */
  .hero p {
    margin-bottom: 0.75rem; /* Reduced from default 1.5rem */
    font-size: 1.05rem; /* Slightly smaller on mobile */
  }
  
  /* Button sizing on mobile */
  .cta-button {
    width: 100%; /* Full width buttons for easier tapping */
    margin-top: 0.5rem; /* Reduced from 0.75rem */
    padding: 0.85rem 1.5rem; /* Slightly more compact */
  }
}

/* Extra small devices */
@media (max-width: 380px) {
  .logo { font-size: 0.85rem; }
  .nav-pill-short { font-size: 0.6rem; padding: 2px 5px; }
}
