/* ==========================================
   GLOBAL CSS RESET & BASE STYLES
   Educational Institute Website
   ========================================== */

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

html {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--neutral-800);
  background-color: #ffffff;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--neutral-900);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.25rem, 4vw, 3.5rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.35rem, 2vw, 1.75rem); }
h4 { font-size: clamp(1.15rem, 1.5vw, 1.35rem); }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  color: var(--neutral-600);
  line-height: 1.7;
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--brand-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--brand-blue-hover);
}

img, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  background: none;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.section {
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-3xl);
}

@media (max-width: 768px) {
  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .section {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }
}

@media (max-width: 480px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
}

.section-bg-light {
  background-color: var(--neutral-50);
}

.section-bg-dark {
  background-color: var(--neutral-900);
  color: #ffffff;
}

.section-bg-dark h1,
.section-bg-dark h2,
.section-bg-dark h3,
.section-bg-dark h4 {
  color: #ffffff;
}

.section-bg-dark p {
  color: var(--neutral-300);
}

/* Section Header Component */
.section-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto var(--space-2xl) auto;
}

.section-header .section-tag {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background-color: var(--brand-blue-light);
  color: var(--brand-blue);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-sm);
}

.section-header p {
  font-size: 1.1rem;
  margin-top: var(--space-sm);
}

@media (max-width: 640px) {
  .section-header {
    margin-bottom: 1.5rem;
  }
  .section-header p {
    font-size: 0.98rem;
  }
}

/* Responsive Table Container Wrapper */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-200);
  margin-bottom: 1rem;
  background-color: #ffffff;
}

.table-container::-webkit-scrollbar {
  height: 6px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: 99px;
}

/* Flex & Grid Helper Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.gap-2xl { gap: var(--space-2xl); }
.gap-3xl { gap: var(--space-3xl); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

@media (max-width: 992px) {
  /* Override inline grid column spans on mobile to prevent overlapping columns & cutoffs */
  div[style*="grid-column: span"],
  div[style*="grid-column:span"] {
    grid-column: 1 / -1 !important;
  }

  /* Disable sticky position on mobile for inline sticky sidebars to prevent footer overlaps */
  div[style*="position: sticky"]:not(.main-header):not(.mobile-sticky-cta),
  div[style*="position:sticky"]:not(.main-header):not(.mobile-sticky-cta) {
    position: static !important;
  }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { 
    grid-template-columns: 1fr !important; 
  }
  .gap-2xl, .gap-3xl { gap: 1.25rem; }
  .gap-xl { gap: 1rem; }

  /* Mobile Touch Input Optimization (Prevents iOS WebKit Auto-zoom) */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="number"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Visually Hidden for Screen Readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
