 :root {
    --primary: #2c5282;       /* Primary color: deep blue */
    --text-main: #2d3748;     /* Main text color */
    --text-light: #718096;    /* Secondary text color */
    --bg-page: #ffffff;       /* Page background: pure white */
    --bg-section: #f8fafc;    /* Section background: very light blue-gray for distinction */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.7;
    margin: 0;
    color: var(--text-main);
    background: var(--bg-page);
}

/* Layout container */
.container {
    max-width: 700px; /* Slightly narrower for better readability */
    margin: 0 auto;
    padding: 0 25px;
}

/* Header: removed bottom thick blue line */
header {
    padding: 40px 0 20px 0; /* Increased top spacing */
    margin-bottom: 40px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-main); /* Name changed to dark color, no longer forced to blue */
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-item {
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-item:hover {
    color: var(--primary);
}

/* Highlight button (e.g., Thesis) - changed to plain text bold or minimal background */
.nav-item.highlight {
    color: var(--primary);
    font-weight: 600;
}

/* Main introduction area */
.hero {
    text-align: left; /* Left-aligned for modern personal page look */
    margin-bottom: 60px;
}

h1 {
    font-size: 2.8rem;
    margin: 0 0 10px 0;
    color: var(--text-main);
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.3rem;
    color: var(--text-light);
    margin: 0;
    font-weight: 400;
}

/* Intro card: removed border and shadow, changed to very light background */
.card {
    background: var(--bg-section);
    padding: 40px;
    border-radius: 12px; /* Softer rounded corners */
    margin-bottom: 60px;
    border: none; /* Completely removed border */
}

.card h2 {
    margin-top: 0;
    color: var(--text-main);
    font-size: 1.5rem;
    font-weight: 600;
}

.card p {
    margin-bottom: 15px;
    color: var(--text-main);
}

/* Tag cloud */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 25px;
}

.tag {
    background: #e2e8f0; /* Use section background color for consistency */
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 6px; /* Small rounded corners */
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.tag:hover {
    background: #cbd5e0;
}

footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid #edf2f7; /* Very light separator line */
}

/* Mobile responsive */
@media (max-width: 600px) {
    nav { flex-direction: column; align-items: flex-start; gap: 15px; }
    h1 { font-size: 2.2rem; }
    .card { padding: 25px; }
}

/* Project entries */
.date {
    display: block;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.bullets {
    margin: 12px 0 0 0;
    padding-left: 20px;
}

.bullets li {
    margin-bottom: 6px;
    color: var(--text-main);
}

.card a {
    color: var(--primary);
    text-decoration: none;
}

.card a:hover {
    text-decoration: underline;
}

/* Card with figure */
/* Global fallback: images never exceed their container */
.card img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

/* Top layout: image takes full card width */
.card.figure-top .thumb {
    margin-bottom: 18px;
}

/* Side layout */
.card.figure-side {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.card.figure-side .thumb {
    flex: 0 0 38%;
    min-width: 0;        /* Key: allow flex items to shrink to prevent overflow */
}
.card.figure-side .text {
    flex: 1;
    min-width: 0;        /* Also prevent text from breaking the container */
}

/* Image carousel */
.image-carousel {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.carousel-arrow {
    background: #e2e8f0;
    color: var(--text-main);
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.carousel-arrow:hover {
    background: #cbd5e0;
}

.carousel-image-container {
    position: relative;
    width: 500px;
    height: 350px;
    overflow: hidden;
}

.carousel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 6px;
}

.carousel-image.active {
    opacity: 1;
}

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