/* ============================================================
   esaLab — main.css
   Single source of truth for all styles.
   Bootstrap 5 is loaded via CDN (link tag in HTML).
   This file only contains: tokens, custom components, overrides.
   ============================================================ */

/* ── 1. Design Tokens ───────────────────────────────────────── */
:root {
  /* Brand palette */
  --clr-bg:        #0b0f1a;
  --clr-surface:   #111827;
  --clr-surface-2: #1c2535;
  --clr-border:    rgba(255,255,255,0.08);
  --clr-accent:    #3b82f6;       /* electric blue */
  --clr-accent-2:  #10b981;       /* geo-green */
  --clr-text:      #e2e8f0;
  --clr-text-muted:#94a3b8;
  --clr-heading:   #f8fafc;
  --clr-navy:      #0a1628;

  /* Spinner gradient colours */
  --hue: 223;
  --bg:  hsl(var(--hue),90%,95%);
  --fg:  hsl(var(--hue),90%,5%);
  --trans-dur: 0.3s;
  --r1: #ad2486; --r2: #d78437; --r3: #f2bc09; --r4: #aaaf44;
  --r5: #5da183; --r6: #1d96b9; --r7: #1c61c2; --r8: #ee692c;

  /* Typography */
  /* Change all typography to Poppins or Helvetica Neue for a more modern and clean look. */
  --font-display: 'Poppins', 'Helvetica Neue', sans-serif;
  --font-body:    'Poppins', 'Helvetica Neue', sans-serif;

  /* --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace; */

  /* Spacing */
  --nav-h: 62px;
  --section-gap: clamp(3rem, 8vw, 6rem);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Wide gamut colours for displays that support it */
@supports (color: color(display-p3 0.55 0.19 0.71)) {
  :root {
    --r1: color(display-p3 0.685 0.008 0.805);
    --r2: color(display-p3 1 0.684 0);
    --r3: color(display-p3 1 0.902 0);
    --r4: color(display-p3 0.639 0.87 0.03);
    --r5: color(display-p3 0 0.935 0.63);
    --r6: color(display-p3 0 0.862 0.935);
    --r7: color(display-p3 0.005 0.428 1);
    --r8: color(display-p3 1 0.716 0.005);
  }
}

/* ── 2. Fonts (Google Fonts web import) ──────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* ── 3. Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding-top: var(--nav-h);
  background-color: var(--clr-bg);
  color: var(--clr-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

p { text-align: justify; }
p a { color: var(--clr-accent); }
p a:hover { text-decoration: underline; }

strong { font-weight: 700; }

/* ── 4. Navigation ───────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: rgba(10, 22, 40, 0.92) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--clr-border) !important;
}

.navbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  color: var(--clr-heading) !important;
  transition: opacity 0.2s;
}
.navbar-brand:hover { opacity: 0.8; }

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--clr-text-muted) !important;
  padding: 0.4rem 0.75rem !important;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  position: relative;
}
.nav-link:hover,
.nav-link.active {
  color: var(--clr-heading) !important;
  background: rgba(59,130,246,0.1);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--clr-accent);
  border-radius: 2px;
}

/* ── 5. Loading Spinner (navbar SVG) ─────────────────────────── */
.spinner-container {
  display: grid;
  place-items: center;
  height: 40px;
  width: 50px;
  transition: opacity 0.6s var(--ease-out);
}
.spinner-container.spinner--hidden {
  opacity: 0;
  pointer-events: none;
}

.ip { width: 2.2em; height: 2.2em; }
.ip__track { stroke: hsl(var(--hue),50%,50%); transition: stroke var(--trans-dur); }
.ip__worm1, .ip__worm2 { animation: worm1 2s linear infinite; }
.ip__worm2 { animation-name: worm2; }

@keyframes worm1 {
  from { stroke-dashoffset: 0; }
  50%  { animation-timing-function: steps(1); stroke-dashoffset: -358; }
  50.01% { animation-timing-function: linear; stroke-dashoffset: 358; }
  to   { stroke-dashoffset: 0; }
}
@keyframes worm2 {
  from { stroke-dashoffset: 358; }
  50%  { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -358; }
}

/* ── 6. Page Hero (shared) ────────────────────────────────────── */
.page-hero {
  padding: calc(var(--section-gap) * 0.8) 0 var(--section-gap);
  text-align: center;
}
.page-hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--clr-heading);
  margin: 0;
}
.page-hero .lead {
  color: var(--clr-text-muted);
  max-width: 56ch;
  margin: 1rem auto 0;
}

/* ── 7. Home — Globe hero ─────────────────────────────────────── */
#globe-hero {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--clr-navy);
}

#globe-container {
  position: absolute;
  inset: 0;
  z-index: 0;
}
#globe-container canvas { display: block; width: 100% !important; height: 100% !important; }

.globe-overlay {
  position: relative;
  z-index: 2;
  width: 100%;
  pointer-events: none;
}

.globe-text {
  max-width: 540px;
  pointer-events: auto;
}
.globe-text h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  color: #fff;
  line-height: 1.2;
}
.globe-text p { color: rgba(255,255,255,0.82); font-size: 1rem; }

.globe-carousel {
  max-width: 400px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  pointer-events: auto;
}
.globe-carousel .carousel-item { height: 280px; }
.globe-carousel .carousel-item img { width: 100%; height: 100%; object-fit: cover; }

/* ── 8. Welcome banner (home) ─────────────────────────────────── */
#welcome-banner {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 12px;
  padding: 1.25rem 1.75rem;
  margin: 2rem 0;
}
#welcome-message {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--clr-heading);
  transition: opacity 0.4s var(--ease-out);
  text-align: center;
  /* Rotating conic border */
  --angle: 120deg;
  border: 3px solid transparent;
  border-image: conic-gradient(
    from var(--angle),
    var(--r7), var(--r6), var(--r5), var(--r4),
    var(--r3), var(--r2), var(--r1), var(--r8)
  ) 1;
  animation: border-rotate 3s linear infinite;
  padding: 0.5rem 1.5rem;
}
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
@keyframes border-rotate { to { --angle: 800deg; } }

/* ── 9. Profile / intro cards ─────────────────────────────────── */
.intro-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  padding: 2rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.intro-card:hover {
  border-color: var(--clr-accent);
  box-shadow: 0 0 32px rgba(59,130,246,0.12);
}
.intro-card img {
  border-radius: 50%;
  width: min(180px, 100%);
  box-shadow: 0 0 0 4px var(--clr-accent);
  margin: 0 auto 1.5rem;
}

/* ── 10. Services page ────────────────────────────────────────── */
.service-row {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.3s;
}
.service-row:hover { border-color: var(--clr-accent-2); }

.service-img {
  height: 260px;
  object-fit: cover;
  width: 100%;
}
.service-body { padding: 2rem; }
.service-body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--clr-heading);
  margin-bottom: 0.75rem;
}

/* ── 11. Projects page ────────────────────────────────────────── */
.project-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 48px rgba(0,0,0,0.4);
}
.project-card-img {
  height: 220px;
  object-fit: cover;
  width: 100%;
}
.project-card-body { padding: 1.5rem; }
.project-card-body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--clr-heading);
  line-height: 1.4;
}
.project-card-body p { font-size: 0.9rem; color: var(--clr-text-muted); }

/* ── 12. About page ───────────────────────────────────────────── */
body.about-page { background: var(--clr-bg); }

#background-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  opacity: 0.35;
}

.about-section {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.about-section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--clr-accent);
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.about-section h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--clr-heading);
  font-size: 1.05rem;
}

/* ── 13. Contact page ─────────────────────────────────────────── */
.contact-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  padding: 2rem;
}
.contact-card h2 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--clr-accent-2);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.contact-card address { color: var(--clr-text-muted); font-style: normal; line-height: 2; }
.contact-card address a { color: var(--clr-text); }
.contact-card address a:hover { color: var(--clr-accent); }

/* Form overrides for dark theme */
.form-control, .form-select {
  background-color: var(--clr-surface-2) !important;
  border-color: var(--clr-border) !important;
  color: var(--clr-text) !important;
}
.form-control:focus, .form-select:focus {
  border-color: var(--clr-accent) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2) !important;
}
.form-label { color: var(--clr-text-muted); font-size: 0.85rem; }
.input-group-text {
  background: var(--clr-surface-2) !important;
  border-color: var(--clr-border) !important;
  color: var(--clr-text-muted) !important;
}
.map-embed {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--clr-border);
}

/* ── 14. Footer ───────────────────────────────────────────────── */
footer {
  background: var(--clr-surface) !important;
  border-top: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  font-size: 0.875rem;
}
footer h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--clr-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}
footer ul li { margin-bottom: 0.35rem; }
footer a { color: var(--clr-text-muted); text-decoration: none; transition: color 0.2s; }
footer a:hover { color: var(--clr-accent); }
footer address { font-style: normal; color: var(--clr-text-muted); }

.footer-icon { width: 1em; height: 1em; display: inline-block; vertical-align: middle; margin-right: 0.3em; }

/* ── 15. Buttons ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--clr-accent) !important;
  border-color: var(--clr-accent) !important;
  font-weight: 600;
  border-radius: 8px;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-outline-primary {
  color: var(--clr-accent) !important;
  border-color: var(--clr-accent) !important;
}
.btn-outline-primary:hover {
  background: var(--clr-accent) !important;
  color: #fff !important;
}

/* ── 16. Scroll-reveal animations ─────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal-slide {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal-slide:nth-child(even) { transform: translateX(-60px); }

.reveal.is-visible,
.reveal-slide.is-visible {
  opacity: 1;
  transform: translate(0);
}

/* Stagger for siblings */
.reveal:nth-child(2), .reveal-slide:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3), .reveal-slide:nth-child(3) { transition-delay: 0.2s; }
.reveal:nth-child(4), .reveal-slide:nth-child(4) { transition-delay: 0.3s; }

/* ── 17. Utility / misc ───────────────────────────────────────── */
.text-accent   { color: var(--clr-accent) !important; }
.text-accent-2 { color: var(--clr-accent-2) !important; }
.section-gap   { padding-top: var(--section-gap); padding-bottom: var(--section-gap); }
.divider { border-color: var(--clr-border); margin: 2.5rem 0; }

figcaption { font-size: 0.8rem; color: var(--clr-text-muted); margin-top: 0.5rem; text-align: center; font-style: italic; }

/* ── 18. Responsive ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  #globe-hero { min-height: 420px; }
  .globe-carousel { max-width: 100%; }
  .globe-text h1 { font-size: clamp(1.25rem, 5vw, 1.8rem); }
}

@media (max-width: 767.98px) {
  #globe-hero { flex-direction: column; min-height: 460px; }
  .service-img { height: 200px; }
  .project-card-img { height: 180px; }
  .about-section { padding: 1.25rem; }
  .contact-card { padding: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
