/* ============================================================
   Matthias J. Ehrhardt — Academic Website
   ============================================================ */

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

/* ---------- Variables ---------- */
:root {
  --primary:        #1e3a5f;   /* navy header */
  --primary-hover:  #2a527a;
  --accent:         #1d6fb5;   /* link colour */
  --accent-hover:   #145a96;
  --bg:             #ffffff;
  --bg-alt:         #f6f8fb;
  --text:           #1a202c;
  --text-muted:     #5a6a7a;
  --border:         #dde3eb;
  --nav-height:     64px;
  --max-width:      1080px;
  --radius:         6px;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Montserrat", sans-serif;
  color: var(--primary);
  margin-top: 1.4em;
  margin-bottom: 0.4em;
}

h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.2rem;  font-weight: 600; }

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

p  { margin: 0.6em 0 0.8em; }
ul, ol { padding-left: 1.4em; }
li { margin: 0.5em 0; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5em 0;
}

/* ---------- Navigation ---------- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--primary);
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1.5rem;
}

.nav-brand {
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff !important;
  text-decoration: none !important;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 0.15rem;
  flex-wrap: nowrap;
  align-items: center;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
}

/* Mobile nav hidden on large screens */
.nav-mobile-toggle { display: none; }

/* ---------- Page wrapper ---------- */
.page-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + 2rem) 1.25rem 3rem;
}

/* Legacy w3-main override */
.w3-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + 2rem) 1.25rem 3rem;
}

/* ---------- Section headings (accordion-style) ---------- */
.section-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.55rem 0.4rem;
  border-radius: var(--radius);
  border-bottom: 2px solid var(--border);
  margin-top: 1.8rem;
  transition: background 0.15s;
  user-select: none;
}

.section-heading:hover { background: var(--bg-alt); }

.section-heading::after {
  content: "▾";
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.section-heading.collapsed::after { transform: rotate(-90deg); }

/* Legacy accordion class kept for JS compatibility */
.my-accordion {
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s;
  /* override w3-button's side padding so accordion headings align with body text */
  padding-left: 0 !important;
  padding-right: 0 !important;
  display: block !important;
  width: 100%;
}
.my-accordion:hover { background: var(--bg-alt) !important; }

/* Shared title style for large section headings */
.section-title {
  color: var(--primary) !important;
  text-align: left;
  display: block;
  width: 100%;
}

/* ---------- Tables ---------- */
table.w3-table,
table {
  border-collapse: collapse;
  width: 100%;
}

table th, table td {
  padding: 0.4rem 0.75rem 0.4rem 0;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

table th {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  width: 80px;
}


/* ---------- Presentation lists ---------- */
.generated-source {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
}

.pub-links {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pub-links a {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  transition: background 0.1s;
}

.pub-links a:hover {
  background: var(--bg-alt);
  text-decoration: none;
}

/* news table */
.news-table th {
  width: 80px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.88rem;
}

/* ---------- Intro / profile layout ---------- */
.intro-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.intro-bio { min-width: 0; }

.intro-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.intro-photo {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  display: block;
}

.intro-contact {
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.6;
}

.intro-contact h1 { margin-top: 0; }

@media (max-width: 700px) {
  .intro-grid {
    grid-template-columns: 1fr;
  }
  .intro-sidebar {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .intro-photo { width: 110px; flex-shrink: 0; }
  .intro-contact { flex: 1; }
  .group-section {
    grid-template-columns: 1fr;
  }
}

/* ---------- Group section layout ---------- */
.group-section {
  grid-template-columns: 1fr 240px;
}

.group-h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin: 1rem 0 0.25rem;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compact-list {
  margin: 0 0 0.5rem 0;
  font-size: 0.92rem;
  line-height: 1.45;
  padding-left: 2rem;
}


/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 1.5rem 1.25rem 1rem;
  text-align: center;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-social {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 0 0.9rem;
}

.footer-social a {
  display: inline-block;
  opacity: 0.35;
  transition: opacity 0.18s;
  text-decoration: none;
}

.footer-social a:hover {
  opacity: 1;
  text-decoration: none;
}

.footer-social img {
  display: block;
  width: 24px;
  height: 24px;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- Utility ---------- */
.my-anchor {
  display: block;
  position: relative;
  top: calc(-1 * var(--nav-height) - 16px);
  visibility: hidden;
}

/* override w3.css top bar height */
.w3-top { height: var(--nav-height) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .nav-links { display: none; }

  .nav-mobile-toggle {
    display: block;
    margin-left: auto;
    background: none;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius);
    color: #fff;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    font-size: 1.1rem;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--primary);
    padding: 0.75rem;
    gap: 0.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }

  .nav-links.open a { padding: 0.55rem 0.75rem; }

  .profile-grid {
    grid-template-columns: 1fr;
  }
  .profile-photo { order: -1; }
  .profile-photo img { width: 90px; }

  .w3-main {
    padding: calc(var(--nav-height) + 1rem) 0.85rem 2rem;
  }
}

/* ---------- Slideshow (index.html) ---------- */
.mySlides { display: none; }

.slideshow-container {
  max-width: 900px;
  position: relative;
  margin: auto;
}

.prev, .next {
  cursor: pointer;
  width: auto;
  padding: 10px;
  color: var(--text);
  font-weight: bold;
  font-size: 18px;
  transition: 0.2s;
  border-radius: var(--radius);
  user-select: none;
}

.prev:hover, .next:hover {
  background: rgba(0,0,0,0.1);
}

.dot {
  cursor: pointer;
  height: 12px;
  width: 12px;
  margin: 0 3px;
  background-color: var(--border);
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.3s;
}

.dot.active, .dot:hover { background-color: var(--accent); }

/* Group pics from index */
.group_pic { width: 100%; max-width: 120pt; }

/* ---------- Print ---------- */
@media print {
  .site-nav { display: none; }
  .w3-main, .page-main { padding-top: 0; }
}
