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

:root {
  --sky: #e8f4f8;
  --sky-dark: #b8d8e8;
  --primary: #1a5276;
  --primary-light: #2e86c1;
  --accent: #e67e22;
  --accent-dark: #d35400;
  --navy: #0d2b45;
  --steel: #5d6d7e;
  --white: #ffffff;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-600: #6c757d;
  --gray-800: #343a40;
  --gray-900: #212529;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--gray-100);
  line-height: 1.6;
}

a {
  color: var(--primary-light);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navigation */
header {
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  max-width: 1100px;
  margin: 0 auto;
  height: 64px;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo a {
  color: var(--white);
  text-decoration: none;
}

.logo-icon {
  font-size: 1.6rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 4px;
}

nav a {
  color: var(--sky);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

nav a:hover,
nav a.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  text-decoration: none;
}

/* Main content */
main {
  min-height: 60vh;
  padding: 40px 0;
}

.page-content h1 {
  font-size: 2rem;
  color: var(--navy);
  margin-bottom: 8px;
}

.page-content h2 {
  font-size: 1.4rem;
  color: var(--primary);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--sky-dark);
}

.page-content h3 {
  font-size: 1.15rem;
  color: var(--steel);
  margin: 24px 0 10px;
}

.page-content p {
  margin-bottom: 16px;
  color: var(--gray-800);
}

.page-content ul, .page-content ol {
  margin: 0 0 16px 24px;
}

.page-content li {
  margin-bottom: 6px;
}

.page-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* Cards */
.card-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  margin: 24px 0;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid var(--gray-200);
}

.card h3 {
  margin-bottom: 8px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: var(--white);
  padding: 80px 0;
  text-align: center;
  border-radius: 0 0 40px 40px;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 2.6rem;
  margin-bottom: 12px;
  color: var(--white);
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 24px;
  color: var(--sky);
}

/* Sections */
.section {
  margin-bottom: 48px;
}

.section h2 {
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 16px;
}

/* Home two-column layout */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

.home-sidebar {
  position: sticky;
  top: 84px;
}

.sidebar-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--gray-200);
}

.sidebar-section h2 {
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--sky-dark);
}

.sidebar-section .event-item {
  padding: 12px 0;
}

.sidebar-section .event-date {
  min-width: 48px;
  padding: 6px;
}

.sidebar-section .event-date .day {
  font-size: 1.1rem;
}

.sidebar-section .event-date .month {
  font-size: 0.65rem;
}

.sidebar-section .event-info h3 {
  font-size: 0.95rem;
}

.sidebar-section .event-info p {
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.sidebar-section .event-info .meta {
  font-size: 0.8rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--white);
  color: var(--white);
}

.btn-outline:hover {
  background: var(--white);
  color: var(--primary);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--gray-800);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(46,134,193,0.15);
}

/* PIN Form */
.pin-form {
  max-width: 360px;
  margin: 24px auto;
  text-align: center;
}

.pin-form input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 8px;
}

.pin-error {
  color: #c0392b;
  font-weight: 600;
  margin-top: 8px;
}

.pin-success {
  color: #27ae60;
  font-weight: 600;
  margin-top: 8px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

thead {
  background: var(--navy);
  color: var(--white);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-200);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--sky);
}

.instructor-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gray-200);
}

/* Photo Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.gallery-item {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: var(--white);
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
}

/* Events */
.event-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-200);
}

.event-item:last-child {
  border-bottom: none;
}

.event-date {
  min-width: 60px;
  text-align: center;
  background: var(--sky);
  border-radius: var(--radius);
  padding: 8px;
  align-self: flex-start;
}

.event-date .day {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
  line-height: 1.2;
}

.event-date .month {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--steel);
  font-weight: 600;
}

.event-info h3 {
  margin-bottom: 4px;
}

.event-info .meta {
  font-size: 0.85rem;
  color: var(--gray-600);
}

/* Events two-column layout */
.events-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.events-upcoming h1 {
  font-size: 1.4rem;
  color: var(--primary);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--sky-dark);
}

.events-recent h2 {
  font-size: 1.4rem;
  color: var(--primary);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--sky-dark);
}

/* Weather */
.weather-card {
  background: linear-gradient(135deg, var(--sky) 0%, var(--white) 100%);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.weather-header {
  margin-bottom: 20px;
}

.weather-temp {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.weather-condition {
  font-size: 1.05rem;
  color: var(--steel);
  margin-top: 4px;
}

.weather-fltcat {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.cat-vfr { background: #27ae60; color: #fff; }
.cat-mvfr { background: #2980b9; color: #fff; }
.cat-ifr { background: #e74c3c; color: #fff; }
.cat-lifr { background: #8e44ad; color: #fff; }

.weather-details-grid {
  display: grid;
  gap: 8px;
  text-align: left;
  max-width: 400px;
  margin: 0 auto 20px;
}

.weather-detail {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--gray-800);
  padding: 4px 0;
  border-bottom: 1px solid var(--gray-200);
}

.weather-detail:last-child {
  border-bottom: none;
}

.detail-icon {
  font-size: 1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.detail-value {
  color: var(--gray-800);
}

.weather-footer {
  font-size: 0.85rem;
  color: var(--gray-600);
  border-top: 1px solid var(--gray-300);
  padding-top: 16px;
  margin-top: 8px;
  line-height: 1.6;
}

.weather-time {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Announcements / Recent Events rendering */
.md-render h2 {
  font-size: 1.3rem;
  color: var(--primary);
  margin: 20px 0 10px;
}

.md-render p {
  margin-bottom: 12px;
}

.md-render ul {
  margin: 0 0 12px 20px;
}

/* Footer */
footer {
  background: var(--navy);
  color: var(--sky);
  padding: 40px 0 24px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 24px;
}

footer h3 {
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 12px;
}

footer ul {
  list-style: none;
}

footer ul li {
  margin-bottom: 6px;
}

footer a {
  color: var(--sky-dark);
}

footer a:hover {
  color: var(--white);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-600);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  nav ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--navy);
    padding: 12px;
    gap: 0;
    box-shadow: var(--shadow-lg);
  }

  nav ul.open {
    display: flex;
  }

  nav a {
    display: block;
    padding: 12px 16px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .hero {
    padding: 48px 0;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

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

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

  .home-layout {
    grid-template-columns: 1fr;
  }

  .home-sidebar {
    position: static;
  }

  .events-layout {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}
