:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #3a3a3a;
  --muted: #707070;
  --soft: #f6f6f6;
  --line: #d6d3c4;
  --maroon: #500000;
  --maroon-dark: #3c0000;
  --red: #500000;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  --shell: 1190px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.65;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--maroon-dark);
}

.shell {
  width: min(var(--shell), calc(100vw - 56px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-block: 32px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #2e2e2e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.brand::before {
  content: "";
  display: block;
  width: 34px;
  aspect-ratio: 247 / 203;
  background: url("../img/tamu-logo.svg") center / contain no-repeat;
  height: auto;
  flex: 0 0 auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 54px);
  color: #777777;
  font-size: 1.02rem;
}

.nav a {
  padding: 1px 6px 2px;
  border: 1px solid transparent;
}

.nav a.active {
  border-color: var(--maroon);
  color: var(--ink);
}

.about-page {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(54px, 9vw, 105px);
  align-items: center;
  min-height: calc(100svh - 178px);
  padding: 52px 0 62px;
}

.portrait-ring {
  width: 212px;
  aspect-ratio: 1;
  justify-self: center;
  padding: 12px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
}

.portrait-ring img {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  filter: grayscale(100%);
  object-fit: cover;
}

.about-copy {
  max-width: 780px;
}

.kicker,
.eyebrow {
  margin: 0 0 10px;
  color: #d7d1c4;
  font-size: 0.92rem;
  font-weight: 400;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  color: #2f2f2f;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.12;
}

h1 {
  font-size: 2.05rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.08rem;
}

p + p {
  margin-top: 16px;
}

.about-copy p:not(.kicker),
.page-intro p,
.timeline p,
.cv-grid p {
  color: #777777;
  font-size: 1.08rem;
}

.about-copy strong {
  color: var(--maroon-dark);
  font-weight: 700;
}

.about-copy strong a {
  border-bottom: 1px solid rgba(80, 0, 0, 0.35);
}

.about-copy strong a:hover,
.about-copy strong a:focus-visible {
  color: var(--maroon);
  border-bottom-color: var(--maroon);
}

.button-pair,
.action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 46px;
  margin-top: 40px;
}

.action-row {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 46px;
}

.button,
.filters button,
.dialog-close {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--maroon-dark);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.button::after,
.filters button::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  width: 86px;
  height: 100%;
  background: var(--maroon);
  clip-path: polygon(42% 0, 100% 0, 100% 100%, 0 100%);
  transition: width 180ms ease, clip-path 180ms ease;
}

.button {
  min-width: 0;
  padding: 0 25px 0 30px;
}

.button:hover,
.button:focus-visible,
.filters button:hover,
.filters button:focus-visible,
.filters button.active {
  color: #fff;
  outline: 0;
}

.button:hover::after,
.button:focus-visible::after,
.filters button:hover::after,
.filters button:focus-visible::after,
.filters button.active::after {
  width: 100%;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.button:hover,
.button:focus-visible,
.filters button:hover,
.filters button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 18px rgba(80, 0, 0, 0.16);
}

.button-label,
.button-icon,
.filter-icon,
.filter-label {
  position: relative;
  z-index: 1;
}

.button-label {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 8px;
  text-align: center;
}

.button-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
}

.button-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.filter-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 21px;
  height: 21px;
}

.filter-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.filter-label {
  min-width: 0;
  white-space: nowrap;
}

.page-intro {
  padding: 78px 0 36px;
}

.page-intro h1 {
  font-size: 2.25rem;
}

.page-intro p {
  margin-top: 10px;
  max-width: 640px;
}

.course-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.course-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
}

.course-legend strong {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--maroon);
  color: #fff;
  font-size: 0.72rem;
}

.course-legend .legend-level-u {
  background: #707070;
}

.research-board {
  padding: 58px 0 66px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 46px;
  margin-bottom: 60px;
}

.filters button {
  min-width: 240px;
  justify-content: flex-start;
  padding-inline: 25px 88px;
}

.paper-wall {
  border-bottom: 1px solid var(--line);
}

.paper-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 34px;
  align-items: center;
  min-height: 150px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}

.paper-row h2 {
  color: #666666;
  font-family: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.35;
}

.paper-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.paper-node {
  position: relative;
  width: 82px;
  height: 82px;
  padding: 5px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}

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

.paper-node.no-figure {
  background: var(--soft);
}

.node-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #fff;
  color: var(--maroon);
  font-size: 1rem;
  font-weight: 800;
}

.paper-node:hover,
.paper-node:focus-visible {
  outline: 0;
  transform: translateY(-2px);
}

.node-new {
  position: absolute;
  top: -4px;
  right: -10px;
  min-width: 34px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #fff;
  color: var(--red);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.12);
}

.node-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 5;
  width: min(260px, 72vw);
  padding: 7px 9px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.paper-node:hover .node-label,
.paper-node:focus-visible .node-label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.paper-card,
.featured-grid,
.paper-grid,
.section-band,
.contact-strip,
.link-list {
  display: none;
}

.tag,
.new-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.new-badge {
  border-color: rgba(178, 58, 50, 0.2);
  color: var(--red);
  font-weight: 800;
  text-transform: uppercase;
}

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.paper-dialog {
  width: min(940px, calc(100% - 36px));
  max-height: min(860px, calc(100svh - 36px));
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.paper-dialog::backdrop {
  background: rgba(255, 255, 255, 0.78);
}

.dialog-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.dialog-image {
  min-height: 100%;
  padding: 34px;
  background: var(--soft);
}

.dialog-image img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.dialog-image.no-figure-panel {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: var(--maroon);
  font-weight: 800;
  text-align: center;
}

.dialog-body {
  padding: 32px 34px 34px;
}

.dialog-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.dialog-close {
  flex: 0 0 auto;
  width: 42px;
  min-height: 42px;
  color: #777;
  box-shadow: none;
}

.dialog-body h2 {
  margin-bottom: 12px;
  color: #2f2f2f;
  font-size: 1.8rem;
}

.dialog-body .authors,
.dialog-body .citation,
.dialog-body .abstract,
.language-warning {
  color: #777777;
}

.dialog-body .abstract {
  margin-top: 18px;
}

.language-switch {
  display: inline-flex;
  gap: 8px;
  margin: 0 0 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.language-switch button {
  min-height: 32px;
  padding: 4px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.language-switch button.active {
  background: #fff;
  color: var(--maroon);
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.language-warning {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--maroon);
  background: var(--soft);
  font-size: 0.94rem;
}

.dialog-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 28px;
}

.paper-action {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 5px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.pdf-action {
  justify-content: center;
  background: var(--maroon);
  color: #fff;
  box-shadow: 0 8px 18px rgba(80, 0, 0, 0.18);
}

.pdf-action:hover {
  background: var(--maroon-dark);
  color: #fff;
}

.source-action,
.secondary-action {
  justify-content: flex-start;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  box-shadow: none;
}

.source-action:hover,
.secondary-action:hover {
  border-color: rgba(80, 0, 0, 0.35);
  color: var(--maroon);
}

.action-tag {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--maroon);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.action-label {
  min-width: 0;
}

.timeline {
  display: grid;
  gap: 18px;
  padding-bottom: 72px;
}

.timeline-item,
.cv-grid article {
  border-top: 1px solid var(--line);
  padding: 24px 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 28px;
}

.timeline-year {
  color: var(--maroon-dark);
  font-weight: 700;
}

.timeline-item h2,
.cv-grid h2 {
  margin-bottom: 8px;
  color: #555;
  font-family: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.08rem;
}

.teaching-role {
  color: var(--maroon-dark);
  font-weight: 700;
}

.teaching-institution {
  color: #777777;
  font-style: italic;
}

.timeline-item .teaching-role + .teaching-institution,
.timeline-item .teaching-institution + p {
  margin-top: 4px;
}

.course-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  color: #777;
}

.course-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-start;
  padding: 11px 0;
  border-top: 1px solid rgba(214, 211, 196, 0.65);
}

.course-main {
  flex: 1 1 370px;
  min-width: 0;
}

.course-name {
  display: block;
  color: #4f4f4f;
  font-weight: 600;
  line-height: 1.35;
}

.course-description {
  max-width: 760px;
  margin-top: 5px;
  color: #777777;
  font-size: 0.94rem;
  line-height: 1.45;
}

.course-badges {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 154px 82px 28px;
  gap: 8px;
  align-items: center;
  justify-content: end;
}

.badge-cell {
  display: flex;
  align-items: center;
  min-width: 0;
}

.badge-cell-syllabus,
.badge-cell-terms {
  justify-content: flex-end;
}

.badge-cell-level {
  justify-content: center;
}

.course-level,
.course-terms,
.course-note,
.course-syllabus {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
}

.course-level {
  justify-content: center;
  width: 24px;
  padding-inline: 0;
  background: var(--maroon);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.course-level-u {
  background: #707070;
}

.course-note {
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 500;
}

.course-syllabus {
  width: 100%;
  justify-content: center;
  border: 1px solid rgba(80, 0, 0, 0.22);
  background: #fff;
  color: var(--maroon);
  font-size: 0.76rem;
  font-weight: 800;
}

.course-syllabus:hover,
.course-syllabus:focus-visible {
  border-color: var(--maroon);
  background: var(--maroon);
  color: #fff;
}

.cv-head {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: end;
}

.cv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 46px;
  padding-bottom: 72px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 38px;
  border-top: 1px solid var(--line);
  color: #9a9a9a;
  font-size: 0.9rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.hidden {
  display: none;
}

.loading {
  color: var(--muted);
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 22px;
  }

  .nav {
    width: 100%;
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .about-page,
  .paper-row,
  .dialog-layout,
  .timeline-item,
  .cv-head {
    grid-template-columns: 1fr;
  }

  .about-page {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
    gap: 32px;
    padding-top: 28px;
  }

  .portrait-ring {
    justify-self: start;
  }

  .filters,
  .button-pair {
    gap: 16px;
  }

  .paper-row {
    align-items: start;
    gap: 18px;
  }

  .course-badges {
    justify-content: start;
  }

  .cv-head {
    display: grid;
  }

  .cv-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 560px) {
  .shell {
    width: min(var(--shell), calc(100vw - 30px));
  }

  .brand {
    gap: 10px;
    font-size: clamp(1.02rem, 5.2vw, 1.18rem);
  }

  .brand::before {
    width: 30px;
  }

  .nav {
    font-size: 0.95rem;
  }

  h1,
  .page-intro h1 {
    font-size: clamp(1.45rem, 6.6vw, 1.65rem);
  }

  .about-copy {
    width: calc(100vw - 30px);
    max-width: calc(100vw - 30px);
    min-width: 0;
  }

  .about-copy p:not(.kicker),
  .page-intro p {
    font-size: 1rem;
    overflow-wrap: anywhere;
  }

  .button-pair {
    grid-template-columns: 1fr;
  }

  .filters {
    gap: 12px;
    margin-bottom: 34px;
  }

  .filters button {
    min-width: min(240px, 100%);
  }

  .paper-nodes {
    gap: 18px;
  }

  .paper-node {
    width: 74px;
    height: 74px;
  }

  .dialog-image {
    padding: 24px;
  }

  .dialog-body {
    padding: 24px;
  }

  .site-footer {
    flex-direction: column;
  }

}
