/* ==========================================================================
   Andreas Mang - Academic Website
   Dark theme stylesheet
   ========================================================================== */

/* ---------- Reset & Base ---------- */

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.7;
  color: #e0e0e0;
  background-color: #111827;
}

/* ---------- Typography ---------- */

h1, h2, h3, h4, h5, h6 {
  color: #f0f0f0;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

h1 { font-size: 1.8rem; }
h2 {
  font-size: 1.45rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #3172AE;
}
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p {
  margin-bottom: 1em;
}

a {
  color: #3172AE;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: #4a9ad4;
  text-decoration: underline;
}

strong { color: #f0f0f0; }

/* ---------- Navbar ---------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(10, 22, 40, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(49, 114, 174, 0.15);
}

.nav-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 54px;
}

.nav-brand {
  display: flex;
  align-items: center;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #f0f0f0;
  font-weight: 600;
  font-size: 1.05rem;
}

.brand-link:hover {
  color: #3172AE;
  text-decoration: none;
}

.brand-icon {
  border-radius: 4px;
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 0.15rem;
}

.nav-link {
  display: block;
  padding: 0.4rem 0.65rem;
  color: #c0c0d0;
  font-size: 0.88rem;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
}

.nav-link:hover,
.nav-link:focus {
  color: #ffffff;
  background-color: rgba(49, 114, 174, 0.1);
  text-decoration: none;
}

.nav-link.active {
  color: #3172AE;
  background-color: rgba(49, 114, 174, 0.12);
}

/* Hamburger toggle */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #e0e0e0;
  margin: 4px 0;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s 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);
}

/* ---------- Hero Banner ---------- */

.hero-banner {
  position: relative;
  height: 250px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #0a1628;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 40, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-content {
  text-align: center;
  padding: 1rem;
  animation: fadeInUp 0.8s ease-out;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.4rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.04em;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: #d0d0e0;
  margin: 0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.02em;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Main Content ---------- */

.site-content {
  min-height: calc(100vh - 54px - 250px - 120px);
}

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

/* Card-style content sections */

.content-container > section,
.content-card {
  background-color: #1a2332;
  border-radius: 8px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(49, 114, 174, 0.08);
}

/* ---------- Two-Column Layout (Home Page) ---------- */

.two-column,
.home-grid {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.two-column .col-photo,
.home-grid .home-photo {
  flex: 0 0 220px;
}

.two-column .col-photo img,
.home-grid .home-photo img,
img.profile-img {
  width: 100%;
  border-radius: 8px;
  border: 2px solid rgba(49, 114, 174, 0.2);
}

.two-column .col-bio,
.home-grid .home-bio {
  flex: 1;
}

/* ---------- Lists ---------- */

ul, ol {
  margin-left: 1.4rem;
  margin-bottom: 1em;
}

li {
  margin-bottom: 0.35em;
}

li > ul,
li > ol {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

/* ---------- Collapsible Sections (details/summary) ---------- */

details {
  background-color: #1a2332;
  border: 1px solid rgba(49, 114, 174, 0.12);
  border-radius: 6px;
  margin-bottom: 1rem;
  overflow: hidden;
}

details > summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: normal;
  color: #f0f0f0;
  background-color: rgba(49, 114, 174, 0.06);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s ease;
}

details > summary:hover {
  background-color: rgba(49, 114, 174, 0.12);
}

details > summary::before {
  content: "\25B6";
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details > summary::-webkit-details-marker {
  display: none;
}

details > .details-content,
details > :not(summary) {
  padding: 0.75rem 1rem;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

thead th {
  background-color: #0a1628;
  color: #f0f0f0;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 2px solid rgba(49, 114, 174, 0.25);
  font-weight: 600;
}

tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

tbody tr:nth-child(odd) {
  background-color: rgba(26, 35, 50, 0.6);
}

tbody tr:nth-child(even) {
  background-color: rgba(17, 24, 39, 0.6);
}

tbody tr:hover {
  background-color: rgba(49, 114, 174, 0.06);
}

/* ---------- Images ---------- */

img {
  max-width: 100%;
  height: auto;
}

figure {
  margin: 1.5rem 0;
  text-align: center;
}

figcaption {
  font-size: 0.88rem;
  color: #a0a0b8;
  margin-top: 0.5rem;
}

/* ---------- Blockquotes ---------- */

blockquote {
  border-left: 3px solid #3172AE;
  margin: 1.2rem 0;
  padding: 0.6rem 1rem;
  color: #c0c0d0;
  background-color: rgba(49, 114, 174, 0.04);
  border-radius: 0 6px 6px 0;
}

/* ---------- Code ---------- */

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
  background-color: rgba(255, 255, 255, 0.06);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background-color: #0a1628;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

pre code {
  background: none;
  padding: 0;
}

/* ---------- Horizontal Rule ---------- */

hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 2rem 0;
}

/* ---------- Footer ---------- */

.site-footer {
  background-color: #0a1628;
  border-top: 1px solid rgba(49, 114, 174, 0.15);
  padding: 1.5rem 1rem;
  text-align: center;
}

.footer-container {
  max-width: 900px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}

.footer-link {
  color: #a0a0b8;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.footer-link:hover {
  color: #3172AE;
  text-decoration: none;
}

.footer-copyright {
  font-size: 0.82rem;
  color: #6a6a82;
  margin: 0;
}

/* ---------- News Items ---------- */

.news-list {
  list-style: none;
  margin-left: 0;
  padding: 0;
}

.news-list li {
  display: flex;
  gap: 1rem;
  padding: 0.4rem 0;
  margin-bottom: 0;
}

.news-date {
  flex: 0 0 4rem;
  color: #3172AE;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.news-text {
  flex: 1;
}

/* ---------- Contact Table ---------- */

.contact-table,
.home-bio table {
  width: auto;
  margin-bottom: 1rem;
  border: none;
}

.contact-table thead,
.home-bio table thead {
  display: none;
}

.contact-table td,
.home-bio table td,
.home-bio table tbody td {
  padding: 0.3rem 0.6rem 0.3rem 0;
  border: none;
  border-bottom: none;
  background: none;
  vertical-align: top;
}

.contact-table tr,
.contact-table tbody tr,
.contact-table tbody tr:nth-child(odd),
.contact-table tbody tr:nth-child(even),
.home-bio table tr,
.home-bio table tbody tr,
.home-bio table tbody tr:nth-child(odd),
.home-bio table tbody tr:nth-child(even) {
  background: none !important;
}

.contact-table tr:hover,
.contact-table tbody tr:hover,
.home-bio table tr:hover,
.home-bio table tbody tr:hover {
  background: none !important;
}

.contact-table td:first-child,
.home-bio table td:first-child {
  white-space: nowrap;
  padding-right: 1.2rem;
}

/* ---------- Social / Profile Links ---------- */

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  margin-bottom: 1rem;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #a0a0b8;
  font-size: 0.85rem;
  transition: color 0.2s ease;
  text-decoration: none;
}

.social-links a:hover {
  color: #3172AE;
  text-decoration: none;
}

.social-links svg {
  flex-shrink: 0;
}

/* ---------- Publication Badges ---------- */

.pub-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.pub-category.journal {
  background-color: rgba(49, 114, 174, 0.2);
  color: #4a9ad4;
}

.pub-category.preprint {
  background-color: rgba(255, 199, 44, 0.15);
  color: #e6b732;
}

.pub-category.conference {
  background-color: rgba(0, 163, 173, 0.15);
  color: #00c4cf;
}

.pub-category.book {
  background-color: rgba(243, 113, 33, 0.15);
  color: #f09050;
}

.pub-category.bookchapter {
  background-color: rgba(140, 71, 153, 0.15);
  color: #b48ec2;
}

/* ---------- Back to Top ---------- */

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  background-color: rgba(49, 114, 174, 0.8);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s ease;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: rgba(49, 114, 174, 1);
}

/* ---------- Utility Classes ---------- */

.text-center { text-align: center; }
.text-muted  { color: #a0a0b8; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ---------- Responsive ---------- */

@media screen and (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 54px;
    left: 0;
    right: 0;
    background-color: rgba(10, 22, 40, 0.97);
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(49, 114, 174, 0.15);
  }

  .nav-menu.is-open {
    display: flex;
  }

  .nav-link {
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
  }

  .navbar {
    position: relative;
  }

  .hero-banner {
    height: 200px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .two-column,
  .home-grid {
    flex-direction: column;
  }

  .two-column .col-photo,
  .home-grid .home-photo {
    flex: none;
    width: 180px;
    margin: 0 auto;
  }

  .content-container {
    padding: 1.25rem 1rem;
  }

  table {
    font-size: 0.82rem;
  }

  thead th,
  tbody td {
    padding: 0.45rem 0.5rem;
  }
}

@media screen and (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }

  .hero-banner {
    height: 170px;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }
}

/* ---------- Print ---------- */

@media print {
  body {
    background: #fff;
    color: #111;
    font-size: 12pt;
  }

  .navbar,
  .hero-banner,
  .site-footer {
    display: none;
  }

  .site-content {
    min-height: auto;
  }

  .content-container {
    max-width: 100%;
    padding: 0;
  }

  .content-container > section,
  .content-card,
  details {
    background: none;
    border: none;
    padding: 0;
  }

  a {
    color: #111;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }
}
