/* ============================================================
   RUBEN DARIO FLOREZ-ZELA · Academic Portfolio
   ============================================================ */

:root {
  --bg:          #1a1a1a;
  --bg-card:     #222222;
  --bg-hover:    #2a2a2a;
  --border:      rgba(255,255,255,0.07);
  --border-mid:  rgba(255,255,255,0.12);
  --text:        #c8c8c8;
  --text-dim:    #7a7a7a;
  --text-bright: #efefef;
  --accent:      #4a9eff;
  --accent-dim:  rgba(74,158,255,0.13);
  --teal:        #2dd4bf;
  --teal-dim:    rgba(45,212,191,0.10);
  --nav-bg:      rgba(26,26,26,0.97);
  --subtle-line: rgba(255,255,255,0.04);
  --row-hover:   rgba(255,255,255,0.018);
  --image-bg:    #111111;
  --sidebar-w:   220px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg:          #f7f8fa;
  --bg-card:     #ffffff;
  --bg-hover:    #eef2f6;
  --border:      rgba(23,37,61,0.10);
  --border-mid:  rgba(23,37,61,0.18);
  --text:        #3f4a59;
  --text-dim:    #6b7788;
  --text-bright: #172033;
  --accent:      #2563a6;
  --accent-dim:  rgba(37,99,166,0.10);
  --teal:        #0f8f80;
  --teal-dim:    rgba(15,143,128,0.09);
  --nav-bg:      rgba(247,248,250,0.95);
  --subtle-line: rgba(23,37,61,0.07);
  --row-hover:   rgba(23,37,61,0.025);
  --image-bg:    #e7ecf2;
  color-scheme: light;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Source Serif 4', Georgia, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: color-mix(in srgb, var(--accent) 78%, white); }
html[data-theme="light"] a:hover { color: #174d82; }
strong { color: var(--text-bright); font-weight: 600; }

/* ── TOP NAV ─────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 2rem 0 calc(var(--sidebar-w) + 3.5rem);
  gap: 0;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-family: 'DM Mono', monospace;
  font-size: 0.73rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  transition: color 0.2s;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-bright);
  border-bottom-color: var(--teal);
}

.nav-cv {
  margin-left: auto;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-dim);
  border: 1px solid var(--border-mid);
  padding: 0.22rem 0.7rem;
  border-radius: 3px;
  transition: all 0.2s;
}

.nav-cv:hover { color: var(--text-bright); background: var(--bg-hover); }

/* ── BODY LAYOUT ─────────────────────────────────────────── */
.layout {
  display: flex;
  max-width: 1060px;
  margin: 0 auto;
  width: 100%;
  padding: 0 2rem;
  gap: 0;
  align-items: flex-start;
  min-height: calc(100vh - 48px);
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 48px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 2.2rem 1.5rem 3rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-right: 1px solid var(--border);
  align-self: flex-start;
}

.sidebar::-webkit-scrollbar { display: none; }

.sidebar-photo {
  width: 150px;
  height: 150px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
}

.sidebar-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-bright);
  text-align: center;
  line-height: 1.35;
}

.sidebar-affil {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.65;
}

.sidebar-affil a { color: var(--text-dim); }
.sidebar-affil a:hover { color: var(--accent); }

/* Metrics box */
.sidebar-stats {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.3rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
  flex: 1;
}

.stat-num {
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-bright);
  line-height: 1.2;
}

.stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.52rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

/* Social links — vertical list */
.sidebar-links {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.sidebar-links li {
  display: flex;
}

.soc-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.1rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.75rem;
  font-family: 'DM Mono', monospace;
  transition: color 0.2s;
  width: 100%;
  line-height: 1;
}

.soc-row svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.soc-row:hover {
  color: var(--text-bright);
}

.soc-row:hover svg { opacity: 1; }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  padding: 2.2rem 0 5rem 3rem;
}

/* ── SECTION LABELS & TITLES ─────────────────────────────── */
.label {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 0.4rem;
  display: block;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 1.8rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.section-block { margin-top: 2.2rem; }

.section-h {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.section-note {
  margin: -0.35rem 0 1.2rem;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.6;
  max-width: 760px;
}

/* ── ABOUT ───────────────────────────────────────────────── */
.about-bio { font-size: 0.92rem; color: var(--text); line-height: 1.85; }
.about-bio p { margin-bottom: 0.95rem; }
.about-bio a { color: var(--accent); }
.about-bio a:hover { text-decoration: underline; }

.phd-note {
  margin-top: 0.4rem;
  padding: 0.6rem 0.85rem;
  border-left: 2px solid var(--teal);
  background: var(--teal-dim);
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin-top: 1.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.tag {
  font-size: 0.68rem;
  font-family: 'DM Mono', monospace;
  color: var(--text-dim);
  border: 1px solid var(--border-mid);
  padding: 0.16rem 0.55rem;
  border-radius: 20px;
  transition: all 0.2s;
}

.tag:hover { color: var(--teal); border-color: var(--teal); }

/* ── NEWS ───────────────────────────────────────────────── */
.news-list { display: flex; flex-direction: column; }

.news-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.9rem;
  padding: 0.48rem 0;
  border-bottom: 1px solid var(--subtle-line);
  align-items: baseline;
}

.news-row:last-child { border-bottom: none; }

.news-date {
  font-family: 'DM Mono', monospace;
  font-size: 0.67rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.news-text { font-size: 0.85rem; color: var(--text); line-height: 1.6; }
.news-text strong { color: var(--text-bright); }

/* ── PUBLICATIONS ───────────────────────────────────────── */
.pub-filters { display: flex; gap: 0.38rem; margin-bottom: 1.3rem; flex-wrap: wrap; }

.pf {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  padding: 0.22rem 0.7rem;
  border-radius: 20px;
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.pf:hover { color: var(--text-bright); border-color: var(--border-mid); }
.pf.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.pub-list { display: flex; flex-direction: column; }

.pub-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.9rem;
  align-items: start;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border);
}

.pub-item:last-child { border-bottom: none; }
.pub-item.hidden { display: none; }
.pub-item:hover { background: var(--row-hover); }

.pub-title { font-size: 0.87rem; font-weight: 500; color: var(--text-bright); margin-bottom: 0.28rem; line-height: 1.5; }
.pub-title a { color: var(--text-bright); }
.pub-title a:hover { color: var(--accent); }

.pub-meta { font-size: 0.74rem; color: var(--text-dim); line-height: 1.55; }

.cit-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.64rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.13rem 0.5rem;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid rgba(74,158,255,0.18);
  flex-shrink: 0;
  margin-top: 2px;
}

.pub-links { display: flex; gap: 0.32rem; margin-top: 0.4rem; flex-wrap: wrap; }

.pub-badge {
  display: inline-block;
  align-self: flex-start;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid rgba(45,212,191,0.22);
  padding: 0.1rem 0.55rem;
  border-radius: 3px;
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}

/* Selected publications on index — badge above, citation next to title */
.pub-item-sel {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.pub-item-sel:last-child { border-bottom: none; }

.pub-title-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.28rem;
}

.pub-title-row .pub-title { flex: 1; margin-bottom: 0; }
.pub-title-row .cit-badge { flex-shrink: 0; margin-top: 2px; }

.pub-link {
  font-family: 'DM Mono', monospace;
  font-size: 0.61rem;
  color: var(--text-dim);
  border: 1px solid var(--border-mid);
  padding: 0.08rem 0.42rem;
  border-radius: 3px;
  transition: all 0.2s;
}

.pub-link:hover { color: var(--accent); border-color: var(--accent); }

.pub-year {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  color: var(--teal);
  letter-spacing: 0.1em;
  padding: 0.9rem 0 0.28rem;
  display: block;
}

.pub-footer-note {
  margin-top: 1.1rem;
  font-size: 0.77rem;
  color: var(--text-dim);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── PROJECTS ───────────────────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.project-card:hover { border-color: var(--border-mid); transform: translateY(-2px); }

.proj-img { width: 100%; height: 165px; object-fit: cover; display: block; background: var(--image-bg); }

.proj-body { padding: 0.95rem; }

.proj-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.38rem; gap: 0.4rem; }

.proj-title { font-size: 0.85rem; font-weight: 600; color: var(--text-bright); line-height: 1.4; }

.proj-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid rgba(45,212,191,0.18);
  padding: 0.1rem 0.42rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.proj-desc { font-size: 0.78rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 0.65rem; }

.proj-tags { display: flex; flex-wrap: wrap; gap: 0.28rem; }

.proj-tag {
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  color: var(--text-dim);
  border: 1px solid var(--border-mid);
  padding: 0.08rem 0.42rem;
  border-radius: 20px;
}

.project-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0 0.15rem;
}

.project-divider-label { font-size: 0.83rem; font-weight: 500; color: var(--text-bright); white-space: nowrap; }

.project-divider-cit {
  font-family: 'DM Mono', monospace;
  font-size: 0.63rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.1rem 0.42rem;
  border-radius: 20px;
  border: 1px solid rgba(74,158,255,0.18);
}

.project-divider-line { flex: 1; height: 1px; background: var(--border); }

/* ── TEACHING ───────────────────────────────────────────── */
.teaching-intro { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 1.7rem; line-height: 1.7; }

.teaching-year-block { margin-bottom: 2rem; }

.t-year {
  font-family: 'DM Mono', monospace;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-bright);
  margin-bottom: 1rem;
  padding-bottom: 0.32rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
}

.t-semester { margin-bottom: 1.2rem; }

.t-sem-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 0.38rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.t-role {
  font-size: 0.6rem;
  font-family: 'DM Mono', monospace;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid rgba(45,212,191,0.18);
  padding: 0.07rem 0.42rem;
  border-radius: 3px;
}

.t-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; table-layout: fixed; }

.t-table th:first-child,
.t-table td:first-child {
  width: 140px;
}

.t-table th:last-child,
.t-table td:last-child {
  width: auto;
}

.t-table th {
  text-align: left;
  padding: 0.32rem 0.7rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--row-hover);
}

.t-table td { padding: 0.44rem 0.7rem; border-bottom: 1px solid var(--subtle-line); color: var(--text); }
.t-table tr:last-child td { border-bottom: none; }
.t-table tr:hover td { background: var(--row-hover); }

.t-code { font-family: 'DM Mono', monospace; font-size: 0.68rem; color: var(--accent); white-space: nowrap; }

.course-en { font-size: 0.72rem; color: var(--text-dim); font-style: italic; margin-left: 0.2rem; }

/* ── CV ─────────────────────────────────────────────────── */
.cv-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  background: var(--accent-dim);
  border: 1px solid rgba(74,158,255,0.22);
  color: var(--accent);
  padding: 0.5rem 1.1rem;
  border-radius: 5px;
  font-size: 0.78rem;
  font-family: 'DM Mono', monospace;
  transition: all 0.2s;
  margin-bottom: 1.8rem;
}

.cv-download-btn:hover { background: rgba(74,158,255,0.2); color: var(--accent); }
.cv-download-btn svg { width: 12px; height: 12px; }

.cv-section { margin-bottom: 2rem; }

.cv-section-title {
  font-size: 0.66rem;
  font-family: 'DM Mono', monospace;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.8rem;
  padding-bottom: 0.32rem;
  border-bottom: 1px solid var(--border);
}

.cv-item {
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--subtle-line);
}

.cv-item:last-child { border-bottom: none; }

.cv-date { font-family: 'DM Mono', monospace; font-size: 0.68rem; color: var(--text-dim); line-height: 1.6; }
.cv-body { font-size: 0.84rem; color: var(--text); line-height: 1.7; }
.cv-body strong { color: var(--text-bright); }
.cv-body small { font-size: 0.74rem; color: var(--text-dim); display: block; margin-top: 0.12rem; }

.ach-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 0.4rem; }

.ach-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 0.85rem; text-align: center; }

.ach-num { font-size: 1.35rem; font-weight: 700; color: var(--text-bright); line-height: 1.1; margin-bottom: 0.22rem; }

.ach-label { font-size: 0.66rem; color: var(--text-dim); line-height: 1.4; }

.review-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }

.review-table th {
  text-align: left;
  padding: 0.42rem 0.7rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.58rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.review-table td { padding: 0.56rem 0.7rem; border-bottom: 1px solid var(--subtle-line); color: var(--text); }
.review-table tr:last-child td { border-bottom: none; }
.review-table tr:hover td { background: var(--row-hover); }
.review-table .j-main { font-weight: 500; color: var(--text-bright); }

.rev-count {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--teal);
  background: var(--teal-dim);
  padding: 0.08rem 0.42rem;
  border-radius: 3px;
  border: 1px solid rgba(45,212,191,0.18);
}

.orcid-note { margin-top: 0.65rem; font-size: 0.72rem; color: var(--text-dim); }
.orcid-note a { color: var(--accent); font-family: 'DM Mono', monospace; }

/* ── FOOTER ─────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.1rem 2rem;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 860px) {
  nav { padding-left: 1.5rem; }
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 1.5rem;
    gap: 1rem;
  }
  .sidebar-photo { width: 65px; height: 65px; }
  .sidebar-name, .sidebar-affil { text-align: left; }
  .main { padding: 1.5rem 1.5rem 4rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

@media (max-width: 480px) {
  .ach-row { grid-template-columns: 1fr 1fr; }
  .cv-item { grid-template-columns: 1fr; gap: 0.1rem; }
}


/* ── 2026 PORTFOLIO REFINEMENTS ────────────────────────── */
.eyebrow {
  display: block;
  margin-bottom: .45rem;
  font-family: 'DM Mono', monospace;
  font-size: .64rem;
  color: var(--teal);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.home-title {
  max-width: 760px;
  margin: 0 0 1.35rem;
  color: var(--text-bright);
  font-size: clamp(1.5rem, 3.2vw, 2.08rem);
  line-height: 1.17;
  font-weight: 600;
  letter-spacing: -.02em;
}

.metric-note,
.metric-inline {
  font-family: 'DM Mono', monospace;
  color: var(--text-dim);
}
.metric-note { margin: -.55rem 0 1.25rem; font-size: .62rem; }
.metric-inline { font-size: .58rem; opacity: .75; }
.impact-row { margin-bottom: .75rem; }

.project-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.project-featured.project-single { grid-template-columns: 1fr; }

.research-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.15rem;
}
.research-card:hover { border-color: var(--border-mid); }
.research-card h2 {
  margin: .55rem 0 .55rem;
  color: var(--text-bright);
  font-size: 1rem;
  line-height: 1.45;
}
.research-card p { font-size: .79rem; color: var(--text-dim); line-height: 1.65; }
.research-card .proj-tags { margin-top: .8rem; }
.research-card .pub-links { margin-top: .8rem; }
.research-card-top { display: flex; justify-content: space-between; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
.project-status,
.research-domain {
  font-family: 'DM Mono', monospace;
  font-size: .57rem;
  letter-spacing: .03em;
}
.project-status { color: var(--teal); }
.research-domain { color: var(--text-dim); }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (max-width: 860px) {
  nav {
    padding: 0 .9rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  nav::-webkit-scrollbar { display: none; }
  .nav-links {
    display: flex;
    gap: 1rem;
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .nav-cv { margin-left: 1rem; flex: 0 0 auto; }
  .project-featured { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .layout { padding: 0 1rem; }
  .sidebar { padding-left: .5rem; padding-right: .5rem; }
  .main { padding-left: .35rem; padding-right: .35rem; }
  .sidebar-stats { max-width: 330px; }
  .news-row { grid-template-columns: 70px 1fr; gap: .65rem; }
  .pub-title-row { flex-direction: column; gap: .35rem; }
  .t-table { font-size: .72rem; }
  .t-table th:first-child, .t-table td:first-child { width: 105px; }
}


/* ── THEME SELECTOR ─────────────────────────────────────── */
.theme-control {
  margin-left: .7rem;
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  flex: 0 0 auto;
}
.theme-control label {
  font-family: 'DM Mono', monospace;
  font-size: .6rem;
  color: var(--text-dim);
}
.theme-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 92px;
  padding: .25rem 1.55rem .25rem .58rem;
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  background-color: var(--bg-card);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: .63rem;
  line-height: 1.25;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 10px) 50%, calc(100% - 6px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.theme-select:hover { border-color: var(--teal); }

.sidebar-photo { transition: filter .25s ease, opacity .2s ease; }
html[data-theme="dark"] .sidebar-photo { filter: grayscale(1); }
html[data-theme="light"] .sidebar-photo { filter: none; }

/* Project media layouts */
.research-card--media {
  display: grid;
  grid-template-columns: minmax(210px, .82fr) minmax(0, 1.4fr);
  gap: 1.1rem;
  align-items: stretch;
}
.research-card-media {
  min-height: 210px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--image-bg);
}
.research-card-media img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  display: block;
}
.research-card-content { min-width: 0; }

@media (max-width: 860px) {
  .theme-control label { display: none; }
  .theme-select { min-width: 82px; }
  .research-card--media { grid-template-columns: 1fr; }
  .research-card-media, .research-card-media img { min-height: 180px; max-height: 320px; }
}

@media (max-width: 560px) {
  .theme-control { margin-left: .45rem; }
  .theme-select { min-width: 74px; padding-left: .45rem; font-size: .59rem; }
}

.project-featured:not(.project-single) > .research-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* ── RESEARCH LINES (index) ─────────────────────────────── */
.section-note {
  max-width: 780px;
  color: var(--text-dim);
  font-size: .82rem;
  line-height: 1.7;
  margin-bottom: 0;
}

.rl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.05rem;
}

.rl-card {
  position: relative;
  overflow: hidden;
  min-height: 172px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: 9px;
  padding: 1.1rem 1.15rem 1.05rem;
  display: flex;
  flex-direction: column;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.rl-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--teal), var(--accent));
  opacity: .85;
}

.rl-card:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
}

.rl-num {
  display: inline-flex;
  align-self: flex-start;
  font-family: 'DM Mono', monospace;
  font-size: .58rem;
  line-height: 1;
  color: var(--teal);
  letter-spacing: .12em;
  background: var(--teal-dim);
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  padding: .3rem .48rem;
}

.rl-card h3 {
  font-size: .98rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: .68rem 0 .42rem;
  line-height: 1.34;
}

.rl-card p {
  font-size: .79rem;
  line-height: 1.62;
  color: var(--text-dim);
  margin: 0;
}

@media (max-width: 640px) {
  .rl-grid { grid-template-columns: 1fr; gap: .8rem; }
  .rl-card { min-height: 0; padding: 1rem 1rem 1rem 1.08rem; }
}
