/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --accent: #F4A261;
  --accent-light: #fce8d2;
  --accent-dark: #c47f3e;
  --text: #2B4C5B;
  --text-light: #5a7a8a;
  --bg: #FEF3E8;
  --bg-alt: #f8e8d8;
  --border: #e0cfc0;
  --radius: 8px;
  --max-width: 1100px;
  --shadow: 0 2px 8px rgba(43,76,91,0.08);
  --shadow-hover: 0 6px 20px rgba(43,76,91,0.14);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
}

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

a:hover {
  text-decoration: underline;
}

/* === Container === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* === Sections === */
.section {
  padding: 64px 0;
}

.section:nth-child(even) {
  background: var(--bg-alt);
}

.section.hero {
  background: var(--text);
}

.section h2 {
  font-size: 1.75rem;
  margin-bottom: 24px;
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 8px;
}

.section h3 {
  font-size: 1.2rem;
  margin: 24px 0 16px;
  color: var(--text);
}

/* === Navigation === */
#navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--text);
  box-shadow: 0 2px 8px rgba(43,76,91,0.2);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.nav-brand:hover {
  text-decoration: none;
  opacity: 0.9;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

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

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.3s;
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

/* === Hero === */
.hero {
  padding: 80px 0 64px;
  background: var(--text);
  color: #fff;
}

.hero-layout {
  display: flex;
  align-items: flex-start;
  gap: 40px;
}

.profile-frame {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.profile-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-text {
  flex: 1;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  font-weight: 700;
}

/* Role cards in hero */
.hero-roles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.role-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius);
  border-left: 4px solid rgba(255,255,255,0.5);
  transition: background 0.2s;
}

.role-card:hover {
  background: rgba(255,255,255,0.15);
}

.role-card--award {
  border-left-color: #F4A261;
  background: rgba(244,162,97,0.15);
}

.role-card--award:hover {
  background: rgba(244,162,97,0.22);
}

.role-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.role-org {
  font-size: 0.85rem;
  opacity: 0.85;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-links a {
  color: #fff;
  background: rgba(255,255,255,0.15);
  padding: 6px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.2s;
}

.hero-links a:hover {
  background: rgba(255,255,255,0.25);
  text-decoration: none;
}

/* === Research Pillars === */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.pillar-card {
  background: var(--bg);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}

.pillar-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.pillar-icon {
  width: 44px;
  height: 44px;
  line-height: 44px;
  margin: 0 auto 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.2rem;
}

.pillar-card h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--text);
}

.pillar-card p {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* === Tags === */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* === Projects === */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 8px;
}

.project-card {
  background: var(--bg);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  border-left: 4px solid var(--accent);
}

.project-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}


.project-card h4 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.4;
  min-height: 2.8em;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  align-items: center;
}

.project-years {
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

.project-funder {
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.75rem;
}

.project-role {
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75rem;
}

.project-role--pi {
  background: #dcfce7;
  color: #166534;
}

.project-role--chalmers-pi {
  background: #dbeafe;
  color: #1e40af;
}

/* Project tags row */
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

.project-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.project-tag--active {
  background: #dcfce7;
  color: #166534;
}

.project-tag--completed {
  background: #f3f4f6;
  color: #6b7280;
}

.project-tag--pi {
  background: #ede9fe;
  color: #6b21a8;
}

.project-tag--chalmers-pi {
  background: #dbeafe;
  color: #1e40af;
}

.project-tag--participating {
  background: #f3f4f6;
  color: #6b7280;
}

.project-desc {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.55;
  flex: 1;
}

/* === Publications === */

/* Filter bar */
.pub-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pub-filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-light);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.pub-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.pub-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pub-topic-btn {
  padding: 4px 12px;
  font-size: 0.8rem;
}

.pub-topic-btn.active {
  background: var(--text);
  border-color: var(--text);
}

/* Search + count */
.pub-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

#pub-search {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

#pub-search:focus {
  border-color: var(--accent);
}

.pub-year-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.pub-entry {
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.pub-entry:hover {
  background: var(--accent-light);
}

.pub-entry + .pub-entry {
  border-top: 1px solid #f0f0f0;
}

.pub-authors {
  color: var(--text-light);
}

.pub-title {
  font-weight: 600;
  color: var(--text);
}

a.pub-title:hover {
  color: var(--accent-dark);
}

.pub-venue {
  font-style: italic;
  color: var(--text-light);
}

/* Type badges */
.pub-type-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 6px;
  vertical-align: middle;
}

.pub-type-badge--journal {
  background: #dbeafe;
  color: #1e40af;
}

.pub-type-badge--conference {
  background: #dcfce7;
  color: #166534;
}

.pub-type-badge--preprint {
  background: #ffedd5;
  color: #9a3412;
}

.pub-type-badge--book-chapter {
  background: #ccfbf1;
  color: #115e59;
}

/* Publication topic tags */
.pub-tags {
  display: inline;
}

.pub-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 500;
  background: var(--accent-light);
  color: var(--accent-dark);
  margin-left: 4px;
  vertical-align: middle;
}

.pub-domain-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 500;
  background: #d4e8e0;
  color: #1a5c3a;
  margin-left: 4px;
  vertical-align: middle;
}

.pub-domain-btn.active {
  background: #2a7a4a;
  border-color: #2a7a4a;
}

/* === TODO === */
.todo-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.todo-list {
  list-style: none;
}

.todo-list li {
  padding: 8px 0 8px 28px;
  position: relative;
  font-size: 0.92rem;
}

.todo-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent);
  border-radius: 3px;
}

.done-list li {
  color: var(--text-light);
  text-decoration: line-through;
}

.done-list li::before {
  background: var(--accent);
  border-color: var(--accent);
}

.done-list li::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 13px;
  width: 10px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

/* === Contact === */
.contact-list {
  list-style: none;
}

.contact-list li {
  padding: 6px 0;
  font-size: 0.95rem;
}

/* === Footer === */
footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 24px 0;
  font-size: 0.85rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--text);
    padding: 8px 24px 16px;
    box-shadow: 0 4px 8px rgba(43,76,91,0.2);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 10px 12px;
  }

  .hero-layout {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-frame {
    width: 140px;
    height: 140px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero-roles {
    grid-template-columns: 1fr;
  }

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

  .pillars-grid .pillar-card:last-child {
    grid-column: span 2;
    max-width: 50%;
    justify-self: center;
  }

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

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

  .section {
    padding: 40px 0;
  }

  .hero {
    padding: 60px 0 40px;
  }

  .pub-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .pub-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .pub-filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .pillars-grid {
    grid-template-columns: 1fr;
  }

  .pillars-grid .pillar-card:last-child {
    grid-column: span 1;
    max-width: 100%;
  }

  .hero-links {
    flex-direction: column;
  }

  .hero-links a {
    text-align: center;
  }
}

/* About blocks */
.about-block {
  position: relative;
  padding: 0.5rem 1rem 0.5rem 1rem;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: background 0.2s, border-color 0.2s;
  margin-bottom: 0.6rem;
}

.about-block:hover {
  background: rgba(0, 0, 0, 0.03);
  border-left-color: var(--accent, #2962ff);
}

.about-block::after {
  content: attr(data-tooltip);
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent, #2962ff);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.about-block:hover::after {
  opacity: 0.6;
}

/* On touch devices, always show labels */
@media (hover: none) {
  .about-block {
    border-left-color: var(--accent, #2962ff);
  }
  .about-block::after {
    opacity: 0.5;
  }
}
