/* ==========================================================================
   components.css — reusable pieces: buttons, tags, cards, filters,
   profile blocks, tables, quotes, notices
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.4375rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition:
    color var(--dur-fast) ease,
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}

/* Press feedback — the interface is listening */
.button:active {
  transform: scale(0.97);
}

.button--primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

@media (hover: hover) and (pointer: fine) {
  .button--primary:hover {
    background: var(--accent-hover);
    color: #ffffff;
  }
}

.button--ghost {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .button--ghost:hover {
    border-color: var(--border-strong);
    background: var(--bg-secondary);
  }
}

.button--subtle {
  color: var(--text-secondary);
}

@media (hover: hover) and (pointer: fine) {
  .button--subtle:hover {
    color: var(--text);
    background: var(--bg-secondary);
  }
}

.button.is-copied {
  color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   Tags
   -------------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.625rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .tag:hover {
    border-color: var(--border-strong);
    color: var(--text);
  }
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag-cloud--large .tag {
  font-size: 0.8125rem;
  padding: 0.3125rem 0.8125rem;
  white-space: normal;
}

/* --------------------------------------------------------------------------
   Icon links (scholar / orcid / mail on cards)
   -------------------------------------------------------------------------- */

.icon-link {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition:
    color var(--dur-fast) ease,
    background-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}

.icon-link:active {
  transform: scale(0.94);
}

@media (hover: hover) and (pointer: fine) {
  .icon-link:hover {
    color: var(--accent-hover);
    background: var(--bg-secondary);
  }
}

/* --------------------------------------------------------------------------
   Avatars
   -------------------------------------------------------------------------- */

.avatar-fallback {
  display: grid;
  place-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Photos fade in once decoded — never pop */
img[data-soft] {
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
}

img[data-soft].is-loaded {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Faculty card
   -------------------------------------------------------------------------- */

.faculty-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition:
    border-color var(--dur-base) ease,
    box-shadow var(--dur-base) ease,
    transform var(--dur-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .faculty-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
}

.faculty-card__top {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.faculty-card__photo {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 1rem;
}

.faculty-card__id {
  min-width: 0;
}

.faculty-card__name {
  font-size: 1.0625rem;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.faculty-card__name a {
  transition: color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .faculty-card__name a:hover {
    color: var(--accent-hover);
  }
}

.faculty-card__meta {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
}

.faculty-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.faculty-card__footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.faculty-card__links {
  display: flex;
  gap: var(--space-1);
}

/* --------------------------------------------------------------------------
   Filter bar
   -------------------------------------------------------------------------- */

.filter-bar {
  margin-top: var(--space-5);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filter {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.filter__label {
  font-size: 0.71875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.filter__select {
  height: 2.375rem;
  padding: 0 2rem 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-elevated);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14'%3E%3Cpath fill='%236b7280' d='M6.7 9.3a1 1 0 0 1 1.4-1.4l3.9 3.88 3.9-3.89a1 1 0 1 1 1.4 1.42l-4.6 4.6a1 1 0 0 1-1.4 0l-4.6-4.6Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  appearance: none;
  -webkit-appearance: none;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.filter__select:focus {
  outline: none;
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--ring);
}

/* --------------------------------------------------------------------------
   Empty / notice states
   -------------------------------------------------------------------------- */

.empty-state {
  margin-top: var(--space-6);
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.empty-state svg {
  margin-inline: auto;
  color: var(--text-faint);
}

.empty-state h3 {
  margin-top: var(--space-4);
  color: var(--text);
  font-size: 1rem;
}

.empty-state p {
  margin-top: var(--space-2);
  font-size: 0.875rem;
}

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.notice--error {
  border-color: color-mix(in srgb, #dc2626 35%, var(--border));
}

.notice--error strong {
  color: var(--text);
}

.notice .button {
  margin-left: auto;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent-hover);
  border-radius: var(--radius-full);
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   Name marquee — giant ghost text drifting behind the profile top
   -------------------------------------------------------------------------- */

.name-marquee {
  position: relative;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  /* Profile cards ride up over the ghost letters for a sense of depth */
  margin-bottom: calc(var(--space-6) * -1);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.name-marquee__track {
  display: flex;
  width: max-content;
  animation: name-drift 70s linear infinite;
  will-change: transform;
}

.name-marquee__group {
  display: flex;
  flex-shrink: 0;
}

.name-marquee__item {
  font-family: var(--font-display);
  font-size: clamp(3.25rem, 9vw, 6.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-right: 4rem; /* even gap, including across the loop seam */
  /* Outline fallback first, then true stroked ghost text where supported */
  color: color-mix(in srgb, var(--text) 10%, transparent);
}

@supports (-webkit-text-stroke: 1px #000) {
  .name-marquee__item {
    color: transparent;
    -webkit-text-stroke: 1.5px color-mix(in srgb, var(--text) 18%, transparent);
  }
}

@keyframes name-drift {
  to {
    transform: translateX(-50%);
  }
}

/* The layout grid sits above the ghost letters */
.profile-layout {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .name-marquee__track {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   Profile sidebar
   -------------------------------------------------------------------------- */

.profile-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
}

.profile-sidebar__inner {
  padding: var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Square portrait, full sidebar width — GitHub-profile proportions */
.profile-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 2.5rem;
  margin-bottom: var(--space-4);
}

.profile-name {
  font-size: 1.375rem;
  letter-spacing: -0.025em;
}

.profile-role {
  margin-top: var(--space-1);
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.profile-links {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2);
  margin-inline: calc(var(--space-2) * -1);
  border-radius: var(--radius-sm);
  font-size: 0.84375rem;
  color: var(--text-secondary);
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.profile-link svg {
  flex-shrink: 0;
  color: var(--text-faint);
  transition: color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .profile-link:hover {
    color: var(--text);
    background: var(--bg-secondary);
  }

  .profile-link:hover svg {
    color: var(--accent-hover);
  }
}

.profile-link__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-block {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.profile-block__title {
  font-size: 0.71875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.availability {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.availability__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.84375rem;
}

.availability__row dt {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.availability__row dd {
  text-align: right;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Profile content sections
   -------------------------------------------------------------------------- */

.content-section {
  padding: var(--space-6);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.content-section__title {
  position: relative;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

/* Accent underline draws in as the section arrives — a reading-position cue */
.content-section__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  border-radius: var(--radius-full);
  background: var(--accent-hover);
  transition: width 700ms var(--ease-out) 250ms;
}

.content-section.is-visible .content-section__title::after {
  width: 2.5rem;
}

.prose {
  color: var(--text);
  max-width: 68ch;
  font-size: 1rem;
  line-height: 1.85;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Editorial drop cap on the About section only */
#about .prose::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 3.2em;
  line-height: 0.85;
  float: left;
  padding: 0.06em 0.14em 0 0;
  color: var(--accent-hover);
}

.section-footer {
  margin-top: var(--space-4);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-3);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--dur-base) ease,
    transform var(--dur-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
  }
}

.stat-card__value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-card__label {
  font-size: 0.78125rem;
  color: var(--text-secondary);
}

/* Idea timeline */
.idea-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.idea-timeline__item {
  position: relative;
  display: flex;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
}

.idea-timeline__item:last-child {
  padding-bottom: 0;
}

/* Connector line between markers */
.idea-timeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.idea-timeline__marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.idea-timeline__item p {
  padding-top: 3px;
  font-size: 1rem;
  line-height: 1.7;
}

@media (hover: hover) and (pointer: fine) {
  .idea-timeline__item:hover .idea-timeline__marker {
    border-color: var(--accent-hover);
    color: var(--accent-hover);
  }
}

.idea-timeline__marker {
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

/* Papers */
.paper-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.paper-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--dur-base) ease,
    box-shadow var(--dur-base) ease,
    transform var(--dur-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .paper-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
  }
}

.paper-card__text {
  font-size: 0.9375rem;
  line-height: 1.75;
}

.paper-card .button {
  align-self: flex-start;
  margin-left: calc(var(--space-2) * -1);
}

/* Course table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.course-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.course-table th {
  text-align: left;
  font-size: 0.71875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.course-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.course-table tbody tr:last-child td {
  border-bottom: none;
}

.course-table tbody tr {
  transition: background-color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .course-table tbody tr:hover {
    background: var(--bg-secondary);
  }
}

/* Quote — quiet inset panel under a large typographic open-quote */
.quote {
  position: relative;
  padding: var(--space-6) var(--space-5) var(--space-5);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.quote::before {
  content: "\201C";
  position: absolute;
  top: -0.35em;
  left: 0.12em;
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  color: color-mix(in srgb, var(--text) 9%, transparent);
  pointer-events: none;
}

.quote__text {
  position: relative;
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.quote__author {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  font-weight: 500;
  color: var(--text-secondary);
}
