/* ============================================================
   Scientific Website — Main Stylesheet
   Theme: Deep Navy + Platinum + Amber accent
   ============================================================ */

:root {
  --bg:           #0a0f1e;
  --bg-surface:   #0e1628;
  --bg-card:      #121e35;
  --bg-card-hover:#162440;
  --border:       #1e3260;
  --border-light: #2a4480;
  --text:         #cdd6f4;
  --text-muted:   #7a8db5;
  --text-dim:     #4a5a7a;
  --accent:       #4f8ef7;
  --accent-glow:  rgba(79,142,247,0.18);
  --amber:        #e8b84b;
  --amber-glow:   rgba(232,184,75,0.15);
  --green:        #3ecf8e;
  --orange:       #f07040;
  --purple:       #a87eff;
  --teal:         #2dd4c4;
  --heading-font: 'Georgia', 'Times New Roman', serif;
  --body-font:    'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono-font:    'JetBrains Mono', 'Consolas', monospace;
  --radius:       8px;
  --radius-lg:    14px;
  --shadow:       0 4px 24px rgba(0,0,0,0.45);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.6);
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body-font);
  line-height: 1.7;
  overflow-x: hidden;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5 {
  font-family: var(--heading-font);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: #e8edf8;
}

h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 0.6em; }
h3 { font-size: 1.25rem; color: var(--accent); margin-bottom: 0.4em; }
h4 { font-size: 1.05rem; color: var(--amber); margin-bottom: 0.3em; }

p { margin-bottom: 1em; color: var(--text); }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #7fb0ff; }

code, kbd {
  font-family: var(--mono-font);
  font-size: 0.88em;
  background: rgba(79,142,247,0.12);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: #a8c8ff;
}

.equation {
  text-align: center;
  margin: 1.4em 0;
  color: var(--amber);
  background: rgba(232,184,75,0.07);
  padding: 0.8em 1.4em;
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow-x: auto;
}
/* Colour MathJax output amber to match the box */
.equation mjx-container[display="true"] { color: var(--amber) !important; }
.equation .MathJax { color: var(--amber) !important; }

/* ============================================================
   NAV
   ============================================================ */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 0;
}

.nav-logo {
  font-family: var(--heading-font);
  font-size: 1.1rem;
  color: #e8edf8;
  white-space: nowrap;
  margin-right: 2.5rem;
  flex-shrink: 0;
}
.nav-logo span { color: var(--accent); }

.nav-items {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0;
  flex: 1;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.3em;
  padding: 0 1rem;
  height: 60px;
  font-size: 0.87rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
  user-select: none;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
.nav-link svg { width: 14px; height: 14px; transition: transform 0.25s; }
.nav-item.open > .nav-link svg { transform: rotate(180deg); }

/* Dropdown */
.dropdown-menu {
  position: absolute;
  top: 60px;
  left: 0;
  min-width: 230px;
  background: rgba(14, 22, 40, 0.97);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
}
.nav-item.open .dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 0.65rem 1.2rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
}
.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover {
  background: var(--accent-glow);
  color: var(--text);
}
.dropdown-menu a .sub-label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 0.1em;
}

/* Mobile hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  margin-left: auto;
  padding: 8px;
}
.hamburger span {
  width: 22px; height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: 0.3s;
}

/* ============================================================
   HERO
   ============================================================ */
#hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('../img/overview_connections.png');
  background-size: cover;
  background-position: center;
  opacity: 0.55;
  filter: brightness(0.8) saturate(1.2);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10,15,30,0.4) 0%,
    rgba(10,15,30,0.2) 40%,
    rgba(10,15,30,0.85) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
  padding: 0 2rem;
}

.hero-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(79,142,247,0.35);
  padding: 0.35em 1em;
  border-radius: 100px;
  margin-bottom: 1.5rem;
}

.hero-title {
  margin-bottom: 1.2rem;
  text-shadow: 0 2px 30px rgba(0,0,0,0.8);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: #9aaed0;
  max-width: 640px;
  margin: 0 auto 2.5rem;
  line-height: 1.65;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.8em;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px rgba(79,142,247,0.4);
}
.btn-primary:hover {
  background: #6fa5ff;
  color: #fff;
  box-shadow: 0 0 30px rgba(79,142,247,0.6);
  transform: translateY(-1px);
}
.btn-outline {
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  background: transparent;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ============================================================
   SECTION LAYOUT
   ============================================================ */
.section {
  padding: 5rem 0 4rem;
  border-top: 1px solid var(--border);
}

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

.section-header {
  margin-bottom: 3rem;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

.section-divider {
  width: 50px;
  height: 2px;
  border: none;
  background: var(--accent);
  margin: 1rem 0 1.5rem;
}

/* ============================================================
   HERO SECTION IMAGE
   ============================================================ */
.section-hero-img {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-lg);
}

/* Thesis figure — dark background, matches POVray renders */
.figure-thesis {
  display: block;
  max-width: 780px;
  width: 100%;
  margin: 0 auto 2.5rem;
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(79,142,247,0.10), var(--shadow-lg);
}
.figure-thesis img {
  width: 100%;
  display: block;
}
.figure-thesis figcaption {
  font-size: 0.80rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.65rem 1.2rem 0.8rem;
  font-style: italic;
  line-height: 1.55;
  border-top: 1px solid var(--border);
}

/* ============================================================
   TWO-COLUMN LAYOUT
   ============================================================ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.two-col.flip { direction: rtl; }
.two-col.flip > * { direction: ltr; }

.img-panel img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
}
.img-caption {
  text-align: center;
  font-size: 0.80rem;
  color: var(--text-dim);
  margin-top: 0.6rem;
  font-style: italic;
}

/* ============================================================
   CARDS
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  box-shadow: 0 0 20px rgba(79,142,247,0.08);
}

.card-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

/* ============================================================
   THESIS REFERENCE BOX
   ============================================================ */
.thesis-ref {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(79,142,247,0.08), rgba(79,142,247,0.03));
  border: 1px solid rgba(79,142,247,0.25);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}
.thesis-ref-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: var(--accent-glow);
  border: 1px solid rgba(79,142,247,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1rem;
}
.thesis-ref-text { color: var(--text-muted); line-height: 1.55; }
.thesis-ref-text strong { color: var(--text); }

/* ============================================================
   SUBSECTION TABS
   ============================================================ */
.tabs {
  margin: 2rem 0;
}
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  overflow-x: auto;
}
.tab-btn {
  flex-shrink: 0;
  padding: 0.65rem 1.3rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   DETAIL LISTS
   ============================================================ */
.detail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 1rem 0;
}
.detail-list li {
  display: flex;
  gap: 0.7em;
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.detail-list li::before {
  content: '▸';
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.1em;
}

/* ============================================================
   HIGHLIGHT BOX
   ============================================================ */
.highlight-box {
  background: linear-gradient(135deg, rgba(62,207,142,0.08), rgba(62,207,142,0.03));
  border-left: 3px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.3rem;
  margin: 1.5rem 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.highlight-box strong { color: var(--green); }

/* ============================================================
   SECTION COLOR THEMES
   ============================================================ */
#energy    .section-tag { color: var(--green); }
#energy    .section-divider { background: var(--green); }
#energy    h3 { color: var(--green); }

#dft       .section-tag { color: var(--purple); }
#dft       .section-divider { background: var(--purple); }
#dft       h3 { color: var(--purple); }

#surface   .section-tag { color: var(--orange); }
#surface   .section-divider { background: var(--orange); }
#surface   h3 { color: var(--orange); }

#statistical .section-tag { color: var(--teal); }
#statistical .section-divider { background: var(--teal); }
#statistical h3 { color: var(--teal); }

#ml        .section-tag { color: var(--amber); }
#ml        .section-divider { background: var(--amber); }
#ml        h3 { color: var(--amber); }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--accent); }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  text-align: left;
  margin-bottom: 2.5rem;
}
.footer-col h5 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 1.5rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .two-col.flip { direction: ltr; }
  #navbar { padding: 0 1.2rem; }
  .nav-logo { margin-right: 0; }
  .nav-items { display: none; position: absolute; top: 60px; left: 0; right: 0;
    background: rgba(10,15,30,0.97); flex-direction: column; border-bottom: 1px solid var(--border);
    padding: 0.5rem 0; }
  .nav-items.open { display: flex; }
  .nav-link { height: 48px; padding: 0 1.5rem; }
  .dropdown-menu { position: static; opacity: 1; pointer-events: auto; transform: none;
    border: none; box-shadow: none; background: transparent; padding-left: 1rem;
    display: none; }
  .nav-item.open .dropdown-menu { display: block; }
  .hamburger { display: flex; }
}

@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: center; }
  .tab-btn { padding: 0.5rem 0.9rem; font-size: 0.8rem; }
}
