/* ============================================================
   Joaquin Endara — Academic Portfolio
   ============================================================ */

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

:root {
  --blue:    #00274C;   /* Michigan blue */
  --accent:  #0057B8;
  --text:    #1a1a1a;
  --muted:   #555;
  --border:  #e5e5e5;
  --bg:      #ffffff;
  --sidebar: 260px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────── */

.wrapper {
  display: flex;
  min-height: 100vh;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  padding: 48px 32px 48px 0;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
  margin-bottom: 20px;
  border: 3px solid var(--border);
}

.sidebar .photo-placeholder {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: #dde3ed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 20px;
  color: var(--blue);
}

.sidebar h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.3;
  margin-bottom: 6px;
}

.sidebar .affiliation {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.sidebar .email {
  font-size: 0.82rem;
  margin-bottom: 24px;
  word-break: break-all;
}

/* ── Navigation ──────────────────────────────────────────── */

nav { margin-bottom: 28px; }

nav a {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 0;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

nav a:hover, nav a.active {
  color: var(--blue);
  text-decoration: none;
}

nav a.active { font-weight: 700; }

/* ── Social links ────────────────────────────────────────── */

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

.social a {
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 4px;
  transition: all 0.15s;
}

.social a:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  text-decoration: none;
}

/* ── Main content ────────────────────────────────────────── */

main {
  flex: 1;
  padding: 48px 0 48px 48px;
}

main h2 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

main p { margin-bottom: 14px; font-size: 0.95rem; }

/* ── Bio page ────────────────────────────────────────────── */

.bio-intro {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--blue);
  margin-bottom: 20px;
}

/* ── Research page ───────────────────────────────────────── */

.paper {
  margin-bottom: 32px;
}

.paper-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.4;
}

.paper-title a { color: var(--text); }
.paper-title a:hover { color: var(--accent); }

.paper-title .jmp-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--blue);
  color: white;
  padding: 2px 7px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
}

.paper-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.paper-venue {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 6px;
}

.abstract-toggle {
  font-size: 0.78rem;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.abstract-toggle:hover { text-decoration: underline; }

.abstract {
  display: none;
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 8px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-left: 3px solid var(--border);
  line-height: 1.6;
}

.abstract.open { display: block; }

/* ── Teaching page ───────────────────────────────────────── */

.term-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.term-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--blue);
  color: white;
  padding: 2px 9px;
  border-radius: 3px;
}

.term-badge.past {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── CV page ─────────────────────────────────────────────── */

.cv-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--blue);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 32px;
  transition: opacity 0.15s;
}

.cv-link:hover { opacity: 0.88; text-decoration: none; color: white; }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 680px) {
  .wrapper { flex-direction: column; padding: 0 16px; }
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 32px 0 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
  }
  .sidebar .photo, .sidebar .photo-placeholder { margin-bottom: 0; }
  nav { margin-bottom: 0; }
  nav a { display: inline; margin-right: 12px; }
  main { padding: 32px 0; }
}
