/* ==========================================================
   Eric-Tuan Lê — Personal Website Stylesheet
   Modern minimalist + dark mode support
========================================================== */

:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --accent: #1877f2;
  --border: #e6e6e6;
  --card-bg: #ffffff;
  --muted: #555;
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0e1116;
  --text: #e8eaed;
  --accent: #66aaff;
  --border: #2a2d33;
  --card-bg: #161a1f;
  --muted: #9ba0a6;
}

/* --- Base --- */
* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  transition: background 0.3s, color 0.3s;
}

/* --- Navbar --- */
.navbar {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
[data-theme="dark"] .navbar {
  background: rgba(22, 24, 28, 0.8);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.8rem 1.2rem;
}

.nav-links a {
  margin: 0 0.8rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
}
.nav-links a:hover {
  color: var(--accent);
}

#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
}

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

.section {
  margin-top: 3rem;
}

h1, h2, h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}
h2 {
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.3rem;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

/* --- Intro Section --- */
.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
}

.profile img {
  width: 160px;
  border-radius: 50%;
}

.bio {
  flex: 1;
  min-width: 260px;
}
.bio h1 {
  font-size: 2rem;
  margin: 0 0 0.3rem;
}
.bio h3 {
  margin-top: 0;
  font-weight: 500;
  color: var(--muted);
}

/* --- Icon Links --- */
.icon-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
  padding: 0;
  margin: 1rem 0 0;
  list-style: none;
}
.icon-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--text);
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
}
.icon-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.icon-links svg {
  opacity: 0.9;
}

/* --- Research Projects --- */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  align-items: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: box-shadow 0.3s ease;
}
.project:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

/* --- Media alignment and sizing (no cropping, resize to fit) --- */
.project .media {
  flex-shrink: 0;
  width: 340px;
  height: 200px; /* consistent height */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card-bg);
}
.project img,
.project video {
  width: 100%;
  height: 100%;
  object-fit: contain; /* ensures full media fits, no cropping */
  border-radius: var(--radius);
  display: block;
}

/* --- Project details --- */
.project .details h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}
.project .details p {
  margin: 0.3rem 0;
}
.project-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.project-links a:hover {
  text-decoration: underline;
}

/* --- Publications --- */
.pubs ul {
  margin: 0;
  padding-left: 1.1rem;
}
.pubs li {
  margin: 0.4rem 0;
}

/* --- Grid Sections (Experience, Education, etc.) --- */
.grid-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.grid-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 0.4rem;
}

.grid-col-left {
  font-weight: 600;
  color: var(--accent);
  flex-basis: 28%;
}
.grid-col-right {
  flex-basis: 72%;
}

/* --- Work Items (logo vertical alignment + sizing) --- */
.grid-row.work-item {
  display: flex;
  align-items: stretch;
  border-bottom: 1px dashed var(--border);
  padding: 0;
}

.grid-row.work-item .grid-col-left {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 0.5rem;
  flex-basis: 160px;
  flex-shrink: 0;
}

.grid-row.work-item .grid-col-right {
  flex: 1 1 auto;
  padding: 0.8rem 0 0.8rem 0.5rem;
}

.company-logo {
  display: block;
  width: 128px;
  height: 128px;
  object-fit: contain;
  opacity: 0.95;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .project {
    flex-direction: column;
  }
  .project .media {
    width: 100%;
    height: 220px;
  }
}

@media (max-width: 700px) {
  .grid-row.work-item {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .grid-row.work-item .grid-col-left {
    justify-content: flex-start;
    flex-basis: 128px;
  }
  .company-logo {
    width: 96px;
    height: 96px;
  }
}
