/* ===== Reset and base ===== */

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

:root {
  --color-bg: #f6f8fb;
  --color-surface: #ffffff;
  --color-text: #2d3548;
  --color-muted: #606a7e;
  --color-heading: #1a2238;
  --color-accent: #4a6396;
  --color-accent-soft: #6b82b0;
  --color-border: #d8dfeb;
  --color-divider: #e6ebf3;
  --color-tab-inactive: #eef1f6;
  --color-tab-active: #ffffff;
  --color-tab-border: #d8dfeb;
  --color-keyword: #a85f47;

  --font-body: Georgia, "Times New Roman", serif;
  --font-heading: system-ui, -apple-system, sans-serif;

  --max-width: 960px;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  line-height: 1.7;
  font-size: 17px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background: linear-gradient(
    165deg,
    #f4f7fb 0%,
    #f8f6fb 40%,
    #f5f9fc 70%,
    #f6f8fb 100%
  );
  background-attachment: fixed;
}

/* ===== Subtle background ===== */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(74, 99, 150, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 99, 150, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse 600px 400px at 10% 20%,
      rgba(120, 150, 210, 0.08) 0%,
      transparent 100%
    ),
    radial-gradient(
      ellipse 500px 500px at 85% 60%,
      rgba(160, 140, 200, 0.06) 0%,
      transparent 100%
    ),
    radial-gradient(
      ellipse 400px 300px at 50% 95%,
      rgba(120, 180, 200, 0.06) 0%,
      transparent 100%
    );
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

.hero,
.hero-divider,
.tabs-section,
footer {
  position: relative;
  z-index: 1;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-heading);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* ===== Biography ===== */

.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 2.5rem;
}

.hero-inner::after {
  content: "";
  display: table;
  clear: both;
}

.hero-photo {
  float: right;
  margin-left: 2rem;
  margin-bottom: 1rem;
  position: relative;
}

.hero-photo::before,
.hero-photo::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--color-accent);
  border-style: solid;
  opacity: 0.45;
  pointer-events: none;
}

.hero-photo::before {
  top: -6px;
  left: -6px;
  border-width: 2px 0 0 2px;
}

.hero-photo::after {
  bottom: -6px;
  right: -6px;
  border-width: 0 2px 2px 0;
}

.hero-photo img {
  display: block;
  width: 240px;
  height: 240px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 16px rgba(74, 99, 150, 0.08);
}

.photo-placeholder {
  width: 240px;
  height: 240px;
  border-radius: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-family: var(--font-heading);
  font-size: 0.85rem;
}

.hero-text h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  line-height: 1.35;
  margin-bottom: 0.2rem;
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.hero-text h1::after {
  content: "";
  display: block;
  width: 40px;
  height: 2px;
  background: var(--color-accent);
  margin-top: 0.4rem;
  margin-bottom: 0.1rem;
  opacity: 0.6;
  border-radius: 1px;
}

.hero-text .subtitle {
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
  letter-spacing: 0.02em;
}

.hero-text p {
  margin-bottom: 0.9rem;
  text-wrap: pretty;
  text-align: left;
  hyphens: manual;
}

.keyword {
  color: #a8642e;
  font-weight: 600;
}

.hero-links {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
}

.hero-links a {
  color: var(--color-muted);
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  transition: all 0.2s;
  background: var(--color-surface);
}

.hero-links a:hover {
  color: var(--color-heading);
  border-color: var(--color-accent);
  background: rgba(74, 99, 150, 0.06);
}

/* ===== Divider ===== */

.hero-divider {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
}

.hero-divider hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-border) 15%,
    var(--color-accent) 50%,
    var(--color-border) 85%,
    transparent
  );
  opacity: 0.5;
}

.hero-divider::after {
  content: "◆";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8px;
  color: var(--color-accent);
  opacity: 0.6;
  background: var(--color-bg);
  padding: 0 12px;
}

/* ===== Folder tabs ===== */

.tabs-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

.tabs-container {
  border: 1px solid var(--color-tab-border);
  border-radius: 0 8px 8px 8px;
  background: var(--color-surface);
  position: relative;
  box-shadow: 0 3px 16px rgba(74, 99, 150, 0.05);
}

.tabs-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(74, 99, 150, 0.1),
    transparent
  );
  pointer-events: none;
}

.tab-bar {
  display: flex;
  position: relative;
  top: -1px;
}

.tab {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--color-tab-border);
  border-bottom: none;
  background: var(--color-tab-inactive);
  color: var(--color-muted);
  cursor: pointer;
  position: relative;
  border-radius: 8px 8px 0 0;
  margin-right: -1px;
  transition: background 0.2s, color 0.2s;
}

.tab:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.tab.active {
  background: var(--color-tab-active);
  color: var(--color-heading);
  font-weight: 600;
  border-bottom: 1px solid var(--color-tab-active);
  z-index: 1;
}

.tab.active::after {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--color-accent);
  border-radius: 0 0 2px 2px;
  opacity: 0.7;
}

.tab-panel {
  display: none;
  padding: 1.75rem 2rem;
}

.tab-panel.active {
  display: block;
}

/* ===== Publications ===== */

.pub-list {
  padding: 0;
}

a.pub-item {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  border-left: 2px solid var(--color-border);
  border-radius: 0 6px 6px 0;
  background: rgba(74, 99, 150, 0.015);
  transition:
    border-color 0.2s,
    background 0.2s,
    transform 0.2s;
}

a.pub-item:hover {
  border-left-color: var(--color-accent);
  background: rgba(74, 99, 150, 0.05);
  color: inherit;
}

a.pub-item:last-child {
  margin-bottom: 0;
}

.pub-title {
  display: block;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 0.35rem;
  color: var(--color-heading);
}

.pub-authors {
  display: block;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--color-muted);
  margin-bottom: 0.15rem;
}

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

.pub-venue {
  display: block;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* ===== Projects ===== */

a.project-card {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

a.project-card:hover {
  color: inherit;
}

.project-card {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 2px solid var(--color-border);
  border-radius: 0 6px 6px 0;
  background: rgba(74, 99, 150, 0.015);
  transition: border-color 0.2s, background 0.2s;
}

.project-card:hover {
  border-left-color: var(--color-accent);
  background: rgba(74, 99, 150, 0.05);
}

.project-card:last-child {
  margin-bottom: 0;
}

.project-card h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin-bottom: 0.15rem;
  color: var(--color-heading);
}

.project-card .meta {
  color: var(--color-muted);
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.project-card p {
  margin-bottom: 0.5rem;
}

/* ===== Notes ===== */

a.note-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-left: 2px solid var(--color-border);
  border-radius: 0 6px 6px 0;
  background: rgba(74, 99, 150, 0.015);
  transition: border-color 0.2s, background 0.2s;
}

a.note-item:hover {
  border-left-color: var(--color-accent);
  background: rgba(74, 99, 150, 0.05);
  color: inherit;
}

a.note-item:last-child {
  margin-bottom: 0;
}

.note-title {
  font-weight: 600;
  color: var(--color-heading);
  font-size: 0.98rem;
}

.note-meta {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
}

/* ===== Teaching ===== */

.tab-panel h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
  color: var(--color-heading);
}

.tab-panel h3:first-child {
  margin-top: 0;
}

.teaching-list {
  list-style: none;
  padding: 0;
}

.teaching-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--color-divider);
  border-radius: 4px;
  transition: background 0.15s;
}

.teaching-list li:hover {
  background: rgba(74, 99, 150, 0.04);
}

.teaching-list li:last-child {
  border-bottom: none;
}

.teaching-list .course {
  font-size: 0.95rem;
}

.teaching-list .semester {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
  margin-left: 1rem;
}

/* ===== Footer ===== */

footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  color: var(--color-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ===== Responsive ===== */

@media (max-width: 640px) {
  .hero-photo {
    float: none;
    margin: 0 auto 1.5rem;
    display: block;
    width: fit-content;
  }

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

  .hero-text p {
    text-align: left;
    hyphens: manual;
  }

  .hero-text h1::after {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-links {
    justify-content: center;
    flex-wrap: wrap;
  }

  .hero-photo::before,
  .hero-photo::after {
    display: none;
  }

  .tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  .tab-panel {
    padding: 1.25rem 1rem;
  }

  a.pub-item,
  .project-card {
    padding: 0.75rem 1rem;
  }

  a.note-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
  }

  .teaching-list li {
    flex-direction: column;
    gap: 0.5rem;
  }

  .teaching-list .semester {
    margin-left: 0;
  }
}

@media (max-width: 420px) {
  .tab {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.4rem;
    font-size: 0.78rem;
  }
}