/* ============================================================
   style.css — Main stylesheet for chuang2.web
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --color-black: black;
  --color-white: white;
  --color-orange: #da6028;
  --color-green: #489788;
  --color-lightgray: #eaedee;
  --color-darkgray: #303030;

  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --header-height: 66px;
}

/* --- Reset / Base --- */
html {
  scroll-padding-top: 70px;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-darkgray);
}

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

a {
  color: inherit;
}

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

/* --- Utility Classes --- */
.mobile-clear {}
.wide-only {}

@media only screen and (max-width: 768px) {
  .mobile-clear {
    clear: both;
  }
  .wide-only {
    width: 0;
    height: 0;
    display: inline-block;
    visibility: hidden;
  }
}

.clear {
  clear: both;
}

.mt-1em {
  margin-top: 1em;
}

.mt-1ex {
  margin-top: 1ex;
}

.h-1em {
  height: 1em;
}

.zi999 {
  z-index: 999;
}

/* --- Section Layout --- */
.section {
  padding: 1em 10%;
}

.section--white {
  color: var(--color-darkgray);
  background-color: var(--color-white);
}

.section--lightgray {
  color: var(--color-black);
  background-color: var(--color-lightgray);
}

.section--darkgray {
  color: var(--color-white);
  background-color: var(--color-darkgray);
}

.section--orange {
  color: var(--color-white);
  background-color: var(--color-orange);
}

.section--green {
  color: var(--color-white);
  background-color: var(--color-green);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.text-heading {
  font-weight: 900;
  font-size: 26px;
}

.text-title {
  font-weight: 600;
  font-size: 22px;
}

.text-subtitle {
  font-weight: 600;
  font-size: 18px;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-italic {
  font-style: italic;
}

.text-bold {
  font-weight: 700;
}

.text-nowrap {
  white-space: nowrap;
}

.text-red {
  color: red !important;
}

.text-blue {
  color: blue !important;
}

.text-violet {
  color: #7950f2 !important;
}

.text-strikethrough {
  text-decoration: line-through;
}

/* --- Header --- */
.header {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  color: rgba(255, 255, 255, .8);
  background-color: rgba(10, 10, 10, .8);
  z-index: 999;
  height: var(--header-height);
}

.header__inner {
  font-size: medium;
  font-weight: bold;
  text-align: center;
}

.header__group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 4px 0;
}

.header__link {
  text-decoration: none;
  color: rgba(255, 255, 255, .8);
}

.header__link:hover {
  color: #fff9e0;
}

.header__link i {
  line-height: inherit;
}

.header__group img {
  height: 24px;
  width: auto;
}

.header-space {
  height: var(--header-height);
}

/* --- Scroll-to-top Button --- */
.scroll-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: none;
  align-items: center;
  gap: 0.5em;
  padding: 0.5em 1em;
  border: none;
  border-radius: 4px;
  background-color: rgba(30, 30, 30, .7);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-stack);
}

.scroll-top-btn:hover {
  background-color: rgba(30, 30, 30, .9);
}

.scroll-top-btn.visible {
  display: flex;
}

/* --- About Section --- */
.headphoto {
  float: left;
  width: 256px;
  margin-right: 1em;
  margin-bottom: 1ex;
  border-radius: 8px;
  filter: drop-shadow(0px 16px 8px #7f7f7f);
}

.sense-logo {
  display: block;
  margin-top: 0.5em;
}

/* --- Lists --- */
ul, ol {
  padding-left: 2em;
}

li {
  margin-bottom: 0.25em;
}

.list-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.25em;
}

.list-icon i {
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.25em 0.75em;
  border-radius: 999px;
  font-size: 0.8125rem;
  text-decoration: none;
  font-weight: 500;
  background-color: #f3f0ff;
  color: #7950f2;
}

.badge:hover {
  opacity: 0.85;
}

.badge--yellow {
  background-color: #fcf3cf;
  color: black;
  border: 2px solid black;
  text-decoration: underline dotted;
  padding: 0.4em 1.2em;
  font-weight: 600;
}

.badge--yellow:hover {
  opacity: 0.85;
}

/* --- Research Section --- */
.badge-row {
  display: flex;
  gap: 1ex;
  flex-wrap: wrap;
  margin: 0.5em 0;
}

/* --- Paper Infographic Card --- */
.paper-card {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 2em 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.paper-card__image {
  width: 25%;
  min-width: 200px;
  aspect-ratio: 3 / 2;
  padding: 1ex;
  box-sizing: border-box;
}

.paper-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.paper-card__content {
  flex: 1;
  min-width: 250px;
}

.paper-card__content h3 {
  margin-top: 0;
}

.paper-card__actions {
  display: flex;
  gap: 0.5em;
  margin-top: 0.5em;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25em 0.6em;
  border: none;
  border-radius: 4px;
  background-color: #f3f0ff;
  color: #7950f2;
  cursor: pointer;
  font-size: 0.8125rem;
  text-decoration: none;
}

.btn-icon:hover {
  background-color: #e5dbff;
}

/* --- People Section --- */
.people-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 14em;
  margin: 1ex 0;
}

.profile__photo {
  width: 2em;
  height: 2em;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.profile__info {
  width: 11em;
}

.profile__info p {
  margin: 0;
}

.profile-name {
  width: 14em;
  text-align: left;
  color: white;
  margin: 0;
  padding: 0.1em 0;
}

.profile-cname {
  width: 6em;
  text-align: left;
  color: white;
  margin: 0;
  padding: 0.1em 0;
}

/* --- Teaching Section --- */
.course-card {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin: 1em 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.course-card__icon {
  font-size: 42px;
  width: 48px;
  text-align: center;
  flex-shrink: 0;
  color: var(--color-darkgray);
}

.course-card__info h2 {
  margin: 0;
}

.course-card__info p {
  margin: 0.25em 0 0;
}

.course-card a {
  color: var(--color-darkgray);
  text-decoration: underline dotted;
}

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

/* --- Course Title Banner --- */
.course-title-list {
  list-style: none;
  padding: 0;
}

.course-title-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  margin-bottom: 0.4em;
}

.course-title-list li i {
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 3px;
}

/* --- News Timeline --- */
.timeline {
  position: relative;
  padding-left: 40px;
  list-style: none;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: #7950f2;
}

.timeline__item {
  position: relative;
  margin-bottom: 1.5em;
}

.timeline__bullet {
  position: absolute;
  left: -40px;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #7950f2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.625rem;
}

.timeline__bullet--red {
  background-color: red;
}

.timeline__date {
  font-weight: 700;
}

.timeline__desc {
  margin-top: 0.25em;
}

.timeline__desc a {
  text-decoration: underline dotted;
  font-weight: 600;
  color: #333;
}

.timeline__desc a:visited {
  text-decoration: underline dotted;
  font-weight: 600;
  color: #333;
}

.timeline__desc a:hover {
  background-color: yellow;
}

/* --- Schedule Table --- */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5em;
  font-size: 0.875rem;
}

.schedule-table th,
.schedule-table td {
  padding: 0.5em 0.75em;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.schedule-table th {
  font-weight: 700;
  background-color: rgba(0, 0, 0, 0.02);
}

/* --- Footer / Contact --- */
.contact-flex {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

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

.contact-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  margin-bottom: 0.5em;
}

.contact-list li i {
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 3px;
}

.contact-list a {
  color: white;
  text-decoration: underline dotted;
}

.contact-list a:hover {
  text-decoration: underline;
}

.footer-copyright {
  font-size: 0.75rem;
  color: var(--color-darkgray);
}

/* --- Map --- */
.map-container {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

#map {
  width: 400px;
  height: 300px;
  border-radius: 8px;
}

/* --- Publication List --- */
.pub-list {
  list-style-type: decimal;
  padding-left: 2em;
}

.pub-list li {
  margin-bottom: 0.75em;
  line-height: 1.5;
}

.pub-badges {
  display: inline-flex;
  gap: 0.25em;
  margin-left: 0.25em;
  vertical-align: middle;
}

.pub-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0.6em;
  border: none;
  border-radius: 4px;
  background-color: #f3f0ff;
  color: #7950f2;
  font-size: 0.6875rem;
  cursor: pointer;
  text-decoration: none;
  width: 4em;
  text-align: center;
}

.pub-badge:hover {
  background-color: #e5dbff;
}

/* --- Citation Drawer / Modal --- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  display: none;
}

.drawer-overlay.open {
  display: block;
}

.drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  background: white;
  z-index: 2000;
  border-radius: 8px 8px 0 0;
  padding: 1.5em 2em;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  color: var(--color-darkgray);
}

.drawer.open {
  transform: translateY(0);
}

.drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.drawer__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  padding: 0.25em;
}

.drawer__close:hover {
  color: #333;
}

.drawer hr {
  border: none;
  border-top: 1px solid #dee2e6;
  margin: 1em 0;
}

.drawer pre {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 1em;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
}

.drawer__infogram {
  float: right;
  width: 20%;
  min-width: 200px;
  margin-left: 1em;
}

.drawer__infogram img {
  width: 100%;
  border-radius: 4px;
  padding: 1ex;
}

/* --- Links --- */
.dotted-link {
  text-decoration: underline dotted;
}

.dotted-link:hover {
  text-decoration: underline;
}

/* --- Code inline --- */
code {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  padding: 0.15em 0.4em;
  font-size: 0.875em;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* --- Responsive --- */
@media only screen and (max-width: 48em) {
  .section {
    padding: 1em 5%;
  }

  .headphoto {
    float: none;
    display: block;
    margin: 0 auto 1em;
  }

  .paper-card {
    flex-direction: column;
  }

  .paper-card__image {
    width: 100%;
    min-width: auto;
  }

  .course-card {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  #map {
    width: 100%;
  }

  .contact-flex {
    flex-direction: column;
  }

  .drawer__infogram {
    float: none;
    width: 100%;
    margin: 0 0 1em 0;
  }
}
