/* ── Base Styles (Mobile First) ─────────────────────────────────────────── */
:root {
  --background-color: #ecf0f1;
  --text-color: #131c26;
  --accent-color: #ef6c00;
  --font-family: 'Arial', sans-serif;
  --icon-color: #000;
  --icon-filter: none;
  --border-color: #ccc;
}

#dark-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-color);
  padding: 0;
  transition: color 0.3s;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  accent-color: var(--accent-color);
  margin: 0;
  padding: 20px;
}

body.dark-mode {
  --background-color: #131c26;
  --text-color: #ecf0f1;
  --accent-color: #ef6c00;
  --icon-color: #fff;
  --icon-filter: brightness(0) invert(1);
  --border-color: #444;
}

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 4rem;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: background 0.3s, box-shadow 0.3s;
  display: flex;
  align-items: center;
}

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

/* Navigation - Mobile First */
.nav {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  position: relative;
}

/* Mobile hamburger menu */
.nav-toggle {
  display: block;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.nav-links {
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  background: var(--background-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem;
  display: none;
  flex-direction: column;
  gap: 1rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.nav-links a {
  position: relative;
  font-weight: 600;
  color: var(--text-color);
  padding: 0.75rem;
  border-radius: 4px;
  text-align: center;
  transition: background-color 0.2s;
}

.nav-links a:hover, .nav-links a:focus, .nav-links a:active {
  color: var(--accent-color);
  background: rgba(239, 108, 0, 0.1);
}
.logo a {
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--text-color);
}
.logo a:hover, .logo a:focus, .logo a:active {
  color: var(--accent-color);
}

.logo a::after, .nav-links a::after {
  display: none !important;
}

/* About Section - Mobile First */
#about {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 50%;
  margin: 0 auto;
  padding: 1rem;
}

#about .about-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.about-text {
  max-width: 70ch;
  line-height: 1.6;
}

.about-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.about-image img {
  width: clamp(150px, 20vw, 250px);
  height: auto;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.about-image .icons img {
  filter: var(--icon-filter);
  transition: filter 0.2s ease;
  width: 24px;
  height: 24px;
}
.about-image .icons img:hover, .about-image .icons img:focus, .about-image .icons img:active {
  filter: var(--icon-filter) drop-shadow(0 0 5px var(--accent-color));
}

#about .decorative-image {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 150px;
  opacity: 0.8;
  z-index: 9999;
}

/* Experience Section - Mobile First */
#experience {
  clear: both;
  margin-top: 2rem;
  padding: 1rem;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

#experience h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.experience-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: center;
}

.experience-entry img {
  width: 100%;
  max-width: 150px;
  height: auto;
  transition: filter 0.2s ease;
}

.experience-text {
  flex: 1;
  min-width: 0;
}

.skills {
  color: var(--accent-color);
}

/* ── Publications / Projects (compact with separators) ───────────────────── */
#projects {
  clear: both;
  margin-top: 2rem;
  padding: 1rem;
  max-width: min(65%, 70ch);
  margin-left: auto;
  margin-right: auto;
}

/* Container for each publication */
.project-entry {
  padding: 0.75rem 0;
  margin: 0;
  border-top: 1px solid var(--border-color);  /* separator line */
}
.project-entry:first-child {
  border-top: none;
}

/* Title: compact and readable */
.project-entry h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  line-height: 1.25;
  color: #5592d7; /* subtle blue like example */
}

/* Callout block (authors/venue) tightened */
.project-callout {
  margin: 0.25rem 0 0;
  padding: 0;
  background-color: transparent;
}

/* Authors / venue line */
.callout-authors {
  margin: 0.25rem 0 0.25rem;
  color: var(--text-color);
  font-size: 0.92rem;
  line-height: 1.35;
}

/* Buttons row */
.project-actions {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

/* Small pill buttons: PDF / Code / Read More */
.project-actions a {
  display: inline-block;
  margin: 0;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  text-decoration: none;
  color: #fff;
  border-radius: 9999px;
  line-height: 1.4;
  transition: opacity 0.2s ease;
}
.project-actions a:hover { opacity: 0.85; }

.btn_pdf { background: #3b82f6; }  /* blue */
.btn_code { background: #38bdf8; } /* cyan */
.btn_read { background: #6b7280; } /* neutral for 'Read More' */

/* Collapsible abstract */
.project-abstract {
  display: block;
  margin: 0.4rem 0 0.35rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

/* Button-like tab */
.abstract-toggle {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  font-weight: 600;
  background: transparent;
  color: var(--accent-color);
  border: none;
  cursor: pointer;
}

/* hide default marker to avoid double caret */
.abstract-toggle::-webkit-details-marker { display: none; }

/* caret */
.abstract-toggle::after {
  content: "▸";
  transition: transform 0.2s ease;
  margin-left: auto;
}

/* expanded caret */
.project-abstract[open] .abstract-toggle::after {
  transform: rotate(90deg);
}

/* body */
.abstract-box {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem 0.65rem;          /* slimmer */
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: var(--background-color, #fff);
  color: var(--text-color, #111);
  line-height: 1.6;
}

/* collapsed preview with gradient fade */
.project-abstract[data-collapsed] .abstract-box {
  max-height: 6.5rem; /* ~4 lines */
  overflow: hidden;
  position: relative;
}
.project-abstract[data-collapsed] .abstract-box::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2.5rem;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--background-color, #ffffff));
}

/* when open, unclamp */
.project-abstract[open] .abstract-box { max-height: none; }

/* CV Section - Mobile First */
#cv .cv-wrapper {
  display: flex;
  flex-direction: column;
  margin: 1rem 0.5rem;
  align-items: flex-start;
}

#cv .sidebar {
  position: relative;
  width: 100%;
  padding: 1rem;
  background: var(--background-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

#cv .sidebar ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

#cv .sidebar a {
  display: block;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: var(--text-color);
  border-radius: 4px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

#cv .sidebar a:hover, #cv .sidebar a.active {
  background: var(--accent-color);
  color: #fff;
}

#cv .cv-content {
  flex: 1;
  padding: 0 1rem;
}

#cv .card {
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  padding: 1rem;
  margin-bottom: 2rem;
  scroll-margin-top: 4rem;
}

#cv .card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

#cv .edu-item, #cv .work-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  margin-left: 0;
  gap: 1rem;
}

#cv .edu-item .dates, #cv .work-item .dates {
  flex: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-color);
  gap: 1rem;
}

#cv .edu-item .dates .date-range, #cv .work-item .dates .date-range {
  font-weight: 600;
}

#cv .edu-item .dates .school-logo, #cv .work-item .dates .company-logo {
  object-fit: contain;
  max-width: 60px;
  height: auto;
  display: block;
}

#cv .edu-item .details, #cv .work-item .details {
  flex: 1;
  margin: 0;
}

#cv .work-item .details h3, #cv .edu-item .details h3 {
  margin-bottom: 0.25rem;
  color: var(--accent-color);
}

#cv .company, #cv .institution {
  font-style: italic;
  margin-bottom: 0.5rem;
}

#cv .desc {
  font-size: 0.95rem;
  color: var(--text-color);
}

#cv .skill-list {
  list-style: disc inside;
  margin: 0.3rem 0;
}

.skill-list li {
  margin: 0.5rem 0;
}

.skills-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.skills-content {
  flex: 1;
}

.skills-image img {
  max-width: 150px;
  height: auto;
  border-radius: 4px;
  display: block;
}

html {
  scroll-behavior: smooth;
}

footer {
  display: flex;
  text-align: center;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
  background-color: var(--background-color);
  color: var(--text-color);
  z-index: -1;
}

/* ── Breakpoints ────────────────────────────────────────────────────────────── */
/* Slightly larger phones & small tablets */
@media (min-width: 600px) {
  .nav {
    padding: 0 2rem;
  }
  
  .nav-toggle {
    display: none;
  }
  
  .nav-links {
    position: static;
    display: flex;
    flex-direction: row;
    background: none;
    border: none;
    padding: 0;
    gap: 1.5rem;
    margin-left: auto;
    box-shadow: none;
  }
  
  .nav-links a {
    padding: 0.5rem;
    text-align: left;
  }
  
  #about {
    padding: 3rem 2rem 0;
    max-width: 60ch;
  }
  #about .decorative-image {
    width: 180px;
  }
  
  #projects {
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: min(65%, 70ch);
  }
  .experience-entry img {
    max-width: 180px;
  }
  
  #cv .cv-wrapper {
    margin: 1.5rem 4rem;
  }
  
  #cv .card {
    padding: 1.5rem;
  }
  
  .skills-image img {
    max-width: 180px;
  }
}

/* Tablets & laptops: side-by-side layout */
@media (min-width: 768px) {
  .nav {
    padding: 0 3rem;
    gap: 2rem;
  }
  
  #about {
    max-width: 800px;
    padding: 3rem 2rem 0;
  }
  #about .about-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 4rem;
  }
  .about-text {
    flex: 2;
  }
  .about-image {
    flex: 1;
  }
  #about .decorative-image {
    width: 200px;
    bottom: 2rem;
    right: 2rem;
  }
  #projects {
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: min(65%, 70ch);
  }
  
  .experience-entry {
    flex-direction: row;
    text-align: left;
    gap: 2rem;
  }
  
  .experience-entry img {
    max-width: 200px;
  }
  
  .experience-text {
    margin-right: 0;
  }
  
  #cv .cv-wrapper {
    flex-direction: row;
    margin: 2rem 4rem;
  }
  
  #cv .sidebar {
    position: sticky;
    top: 4rem;
    width: 180px;
    border-right: 1px solid var(--border-color);
    border-bottom: none;
  }
  
  #cv .sidebar ul {
    flex-direction: column;
  }
  
  #cv .cv-content {
    padding: 0 2rem;
  }
  
  #cv .edu-item, #cv .work-item {
    flex-direction: row;
    margin-left: 1rem;
    gap: 2rem;
  }
  
  #cv .edu-item .dates {
    flex: 0 0 120px;
    flex-direction: column;
    justify-content: flex-start;
    margin-top: 1.3rem;
  }
  
  #cv .work-item .dates {
    flex: 0 0 160px;
    flex-direction: column;
    justify-content: flex-start;
    margin-top: 1.5rem;
  }
  
  #cv .edu-item .dates .school-logo, #cv .work-item .dates .company-logo {
    max-width: 80px;
    margin-top: 0.5rem;
  }
  
  #cv .work-item .dates .company-logo {
    max-width: 120px;
    margin-top: 1rem;
  }
  
  #cv .edu-item .details, #cv .work-item .details {
    margin-left: 2rem;
    margin-right: 0.5rem;
  }
  
  .skills-container {
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
  }
  
  .skills-image img {
    max-width: 200px;
    margin-top: 2rem;
  }
}

/* Large desktops & monitors */
@media (min-width: 1200px) {
  .nav {
    padding: 0 4rem;
  }
  
  #about {
    max-width: 1000px;
    padding: 4rem 3rem 0;
  }
  #about .decorative-image {
    width: 220px;
  }
  
  #projects {
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: min(65%, 70ch);
  }
  
  .experience-entry {
    gap: 4rem;
  }
  
  #cv .cv-wrapper {
    margin: 3rem 7rem;
  }
  
  #cv .card {
    padding: 2rem;
  }
}