/* css/styles.css
   Trading Hemisphere - Unified Modern Design System
   Glassmorphism, Responsive Grid, Animated Backgrounds & Mobile Navigation
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-dark: #071018;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(107, 231, 255, 0.3);
  
  --accent-primary: #31b7e9;
  --accent-gradient: linear-gradient(135deg, #0682b4 0%, #31b7e9 100%);
  --accent-hover: linear-gradient(135deg, #31b7e9 0%, #6be7ff 100%);
  --accent-a: #ff6b6b;
  --accent-b: #ffb86b;
  --accent-c: #6be7ff;
  --accent-d: #7bff9e;
  
  --text: #f1f5f9;
  --muted: #94a3b8;
  --muted-light: #cbd5e1;
  
  --noise-opacity: 0.04;
  --max-width: 1200px;
  --container-padding: 1.5rem;
  --gap: 1.5rem;
  --radius: 12px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 30px rgba(2, 6, 23, 0.45);
  --shadow-lg: 0 18px 45px rgba(2, 6, 23, 0.65);
  --shadow-glow: 0 0 25px rgba(49, 183, 233, 0.25);
}

/* Animations */
@keyframes bgShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes blobFloat {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

body.nav-lock-scroll {
  overflow: hidden;
}

/* Animated Fast Background Layer */
.bg-fast {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(650px 450px at 10% 20%, rgba(255, 107, 107, 0.12), transparent 45%),
    radial-gradient(550px 400px at 85% 30%, rgba(107, 231, 255, 0.14), transparent 40%),
    radial-gradient(550px 450px at 50% 85%, rgba(123, 255, 158, 0.08), transparent 45%),
    linear-gradient(120deg, var(--bg-dark) 0%, rgba(11, 36, 48, 0.95) 40%, rgba(43, 15, 58, 0.9) 100%);
  background-size: 200% 200%;
  animation: bgShift 24s ease-in-out infinite, blobFloat 18s ease-in-out infinite;
  filter: blur(40px) saturate(1.1);
}

.bg-fast::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    radial-gradient(rgba(0, 0, 0, 0.01) 1px, transparent 1px);
  background-size: 8px 8px, 12px 12px;
  opacity: var(--noise-opacity);
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* Layout Container */
.container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--container-padding);
  position: relative;
  z-index: 2;
}

main.container {
  flex: 1;
}

/* Header & Navigation */
.site-header {
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(7, 16, 24, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.site-header.is-scrolled {
  padding: 0.75rem 0;
  background: rgba(7, 16, 24, 0.88);
  border-bottom: 1px solid var(--border-glass);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Brand */
.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  transition: opacity 0.2s ease;
}

.brand:hover {
  opacity: 0.9;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--accent-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #ffffff;
  font-size: 1.15rem;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 15px rgba(6, 130, 180, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
  color: #ffffff;
  line-height: 1.2;
}

.brand-tag {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 0.1rem;
}

/* Site Nav (Desktop) */
.site-nav ul {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  align-items: center;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.25s ease;
  position: relative;
  display: inline-block;
}

.site-nav a:hover, 
.site-nav a:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.site-nav a[aria-current="page"],
.site-nav a.active {
  color: #ffffff;
  background: rgba(49, 183, 233, 0.15);
  border: 1px solid rgba(49, 183, 233, 0.3);
  font-weight: 600;
}

/* Hamburger Toggle Button */
.nav-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 101;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-primary);
}

.hamburger-box {
  width: 20px;
  height: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.is-active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.6rem;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.2;
}

.btn-solid,
.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(6, 130, 180, 0.35);
}

.btn-solid:hover,
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(49, 183, 233, 0.45);
  color: #ffffff;
}

.btn-outline,
.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-glass);
  color: var(--text);
}

.btn-outline:hover,
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  color: #ffffff;
}

/* Hero Section */
.hero {
  padding: 4rem 0 3.5rem;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: 2.5rem;
  align-items: center;
}

.kicker {
  color: var(--accent-c);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1.1;
  margin-bottom: 1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.lede {
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  line-height: 1.5;
  margin-bottom: 1.75rem;
  max-width: 60ch;
}

/* Cards & Media */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  color: var(--text);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
}

.card h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.card-blurb {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  flex: 1;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-glass-hover);
  background: var(--bg-card-hover);
}

.card-media {
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: var(--radius);
  margin-top: auto;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.card:hover .card-media img {
  transform: scale(1.06);
}

/* Figure Card (Hero Aside) */
.figure-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  padding: 0.85rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-md);
}

.figure-card img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.figure-caption,
figcaption {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Chapters & Dynamic Responsive Grid */
.chapters {
  padding: 2.5rem 0 4rem;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}

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

.span-12 { grid-column: span 12; }
.span-8  { grid-column: span 8; }
.span-6  { grid-column: span 6; }
.span-4  { grid-column: span 4; }
.span-3  { grid-column: span 3; }

/* Topic Index Section (Renewables & Pillars) */
.pillar-body {
  padding: 2rem 0 4rem;
}

.topic-index {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-md);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent-c);
  margin-bottom: 1.5rem;
}

.topics {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 0;
  margin: 0;
}

.topics li {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.3s ease;
}

.topics li:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(49, 183, 233, 0.3);
  transform: translateY(-3px);
}

.topic-no {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-primary);
  background: rgba(49, 183, 233, 0.1);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(49, 183, 233, 0.2);
  line-height: 1;
}

.topics h3 {
  font-size: 1.15rem;
  color: #ffffff;
  margin-bottom: 0.4rem;
}

.topics p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* Contact Page Styles */
.contact-hero {
  padding: 3rem 0 5rem;
}

.contact-card {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
}

.contact-card h1 {
  font-size: 2.4rem;
  margin-bottom: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-row.full {
  grid-template-columns: 1fr;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted-light);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  border-color: var(--accent-primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 12px rgba(49, 183, 233, 0.25);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1.5rem;
}

.note {
  font-size: 0.9rem;
  color: var(--muted);
}

.note a {
  color: var(--accent-c);
  text-decoration: none;
}

.note a:hover {
  text-decoration: underline;
}

.success {
  display: none;
  padding: 1rem;
  border-radius: 10px;
  background: rgba(123, 255, 158, 0.12);
  border: 1px solid rgba(123, 255, 158, 0.3);
  color: #7bff9e;
  margin-top: 1.25rem;
  font-weight: 500;
  text-align: center;
}

/* Footer */
.site-footer {
  padding: 2.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 2;
  margin-top: auto;
}

/* Responsive Media Queries */
@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .figure-card img {
    max-height: 260px;
  }

  .chapter-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .span-8, .span-6, .span-4, .span-3 {
    grid-column: span 6;
  }
}

@media (max-width: 820px) {
  /* Mobile Navigation Menu Drawer */
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: rgba(7, 16, 24, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--border-glass);
    padding: 6rem 2rem 2rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .site-nav.nav-open {
    transform: translateX(0);
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .site-nav a {
    padding: 0.85rem 1.25rem;
    font-size: 1.05rem;
    border-radius: 10px;
  }

  .brand-tag {
    display: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  :root {
    --container-padding: 1rem;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

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

  .span-12, .span-8, .span-6, .span-4, .span-3 {
    grid-column: span 1;
  }

  .contact-card, .topic-index {
    padding: 1.5rem;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }
}
