/* ===========================================================================
   Fernando Rodriguez: site styles
   Tokens live in :root. Change the accent in ONE place (--accent) and the
   whole site follows.
   =========================================================================== */

:root {
  --bg:        #ffffff;
  --surface:   #f7f9fa;
  --surface-2: #eef2f4;
  --line:      #e2e8ec;
  --line-soft: #edf1f4;

  --ink:       #0c1418;
  --body:      #3d4a52;
  --muted:     #6b7a84;

  --accent:      #0d7a72;
  --accent-soft: #e6f4f2;
  --accent-ink:  #0a5f59;

  --radius: 10px;
  --wrap: 1120px;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow: 0 1px 2px rgba(12, 20, 24, .04), 0 8px 24px -16px rgba(12, 20, 24, .18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0b1114;
    --surface:   #101a1e;
    --surface-2: #16232a;
    --line:      #1f2f36;
    --line-soft: #18262c;

    --ink:       #eef4f6;
    --body:      #b6c4cb;
    --muted:     #8496a0;

    --accent:      #38bdaf;
    --accent-soft: #0f2b2a;
    --accent-ink:  #5fd4c6;

    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.8);
  }
}

/* --- reset ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

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

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.021em;
  line-height: 1.22;
  margin: 0 0 .5em;
}

h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.35rem, 1.1rem + .9vw, 1.7rem); }
h3 { font-size: 1.06rem; }

p { margin: 0 0 1.05em; }
ul, ol { margin: 0 0 1.05em; padding-left: 1.15em; }
li { margin: .25em 0; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 3rem 0;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; border-radius: 6px; z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}

/* --- small technical bits ------------------------------------------------- */

.label {
  font-family: var(--mono);
  font-size: .688rem;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.mono { font-family: var(--mono); }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .625rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: .16rem .42rem;
  vertical-align: 2px;
  white-space: nowrap;
}

/* --- header --------------------------------------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 66px;
}

.brand { display: flex; align-items: center; gap: .7rem; color: inherit; }
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 22px; height: 22px;
  flex: none;
  border-radius: 5px;
  background:
    linear-gradient(135deg, var(--accent) 0%, var(--accent) 45%, transparent 45%),
    linear-gradient(315deg, var(--accent) 0%, var(--accent) 30%, transparent 30%),
    var(--accent-soft);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.22; }
.brand-name { color: var(--ink); font-weight: 600; font-size: .97rem; letter-spacing: -.01em; }
.brand-role {
  font-family: var(--mono);
  font-size: .656rem;
  letter-spacing: .06em;
  color: var(--muted);
  text-transform: uppercase;
}

.site-nav > ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: .3rem;
  margin: 0; padding: 0;
}
.site-nav > ul > li { margin: 0; }

.site-nav a {
  display: block;
  padding: .42rem .7rem;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--body);
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); }

/* --- Resources dropdown --------------------------------------------------- */

.has-menu { position: relative; }

/* invisible bridge so the menu survives the mouse crossing the gap */
.has-menu::after {
  content: "";
  position: absolute;
  top: 100%; left: 0; right: 0;
  height: 10px;
}

.nav-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  color: var(--body);
  background: none;
  border: 0;
  border-radius: 7px;
  padding: .42rem .7rem;
  cursor: pointer;
}
.nav-menu-btn:hover,
.has-menu:hover .nav-menu-btn,
.nav-menu-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }

.caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4.5px solid currentColor;
  opacity: .6;
  transition: transform .15s ease;
}
.has-menu:hover .caret,
.nav-menu-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

.dropdown {
  list-style: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 248px;
  margin: 0;
  padding: .35rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 60;
}
/* Hover opens it; keyboard users open it with the button, which sets .open.
   Deliberately no :focus-within here; it would fight Escape, since focus
   stays on the trigger after closing. */
.has-menu:hover > .dropdown,
.dropdown.open { display: block; }

.dropdown li { margin: 0; }
.dropdown a {
  padding: .5rem .6rem;
  border-radius: 7px;
  font-weight: 500;
}
.dropdown a:hover { background: var(--accent-soft); color: var(--accent-ink); }

.dd-title { display: flex; align-items: baseline; gap: .35rem; color: var(--ink); }
.dropdown a:hover .dd-title { color: var(--accent-ink); }
.dd-ext { font-size: .75em; opacity: .55; }
.dd-note {
  display: block;
  font-family: var(--mono);
  font-size: .656rem;
  letter-spacing: .05em;
  color: var(--muted);
  margin-top: .1rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .5rem .55rem;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 17px; height: 1.6px;
  background: var(--ink);
  border-radius: 2px;
}
.nav-toggle span + span { margin-top: 4px; }

/* --- hero ----------------------------------------------------------------- */

.hero { padding: clamp(2.6rem, 5vw, 4.5rem) 0 clamp(1rem, 2vw, 1.75rem); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, .9fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.hero h1 { margin-bottom: .35rem; }

.hero-role {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 1.4rem;
}

.hero-lede { font-size: 1.1rem; color: var(--body); max-width: 60ch; }

.portrait {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  aspect-ratio: 1 / 1;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.hero-facts {
  margin-top: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.1rem;
}
.fact { display: flex; gap: .75rem; font-size: .86rem; padding: .3rem 0; }
.fact dt {
  font-family: var(--mono);
  font-size: .656rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 74px;
  padding-top: .18rem;
}
.fact dd { margin: 0; color: var(--body); }

/* --- generic section ------------------------------------------------------ */

.section { padding: clamp(2rem, 3.6vw, 2.8rem) 0; }
.section + .section { border-top: 1px solid var(--line-soft); }
.section-lede { max-width: 66ch; }
.measure { max-width: 900px; }

.page-head {
  padding: clamp(2.4rem, 5vw, 3.6rem) 0 clamp(1.3rem, 2.6vw, 2rem);
  border-bottom: 1px solid var(--line);
}
.page-head h1 { margin-bottom: .45rem; }
.page-head p { max-width: 66ch; margin-bottom: 0; }

/* --- keyword chips -------------------------------------------------------- */

.chips { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; padding: 0; margin: 0; }
.chips li {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .02em;
  color: var(--body);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: .3rem .72rem;
  margin: 0;
}

/* --- cards ---------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.35rem 1.4rem;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.card h3 { margin-bottom: .45rem; }
.card p:last-child { margin-bottom: 0; }
.card-num {
  font-family: var(--mono);
  font-size: .656rem;
  letter-spacing: .12em;
  color: var(--accent-ink);
  display: block;
  margin-bottom: .55rem;
}
.card-refs {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
  margin: .9rem 0 0;
  padding-top: .8rem;
  border-top: 1px solid var(--line);
}

/* --- research themes (full-width rows) ------------------------------------ */

.themes { list-style: none; margin: 0; padding: 0; max-width: 920px; }

.theme {
  padding: 1.9rem 0;
  border-bottom: 1px solid var(--line-soft);
  margin: 0;
}
.theme:first-child { border-top: 1px solid var(--line); }

.theme h3 { font-size: 1.12rem; margin-bottom: .6rem; }
.theme p { font-size: .95rem; }
.theme p:last-of-type { margin-bottom: 0; }
.theme .card-refs { border-top: 0; padding-top: .3rem; margin-top: .9rem; }

/* --- publications --------------------------------------------------------- */

.pub-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0 .2rem;
}
.pub-count { font-family: var(--mono); font-size: .75rem; color: var(--muted); }

.pub-list { list-style: none; margin: 0; padding: 0; max-width: 920px; }

.pub {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line-soft);
  margin: 0;
}
.pub:first-child { border-top: 1px solid var(--line); }

.pub-year {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
  padding-top: .12rem;
  font-variant-numeric: tabular-nums;
}

.pub-title {
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  margin: 0 0 .35rem;
  letter-spacing: -.012em;
}
.pub-authors { font-size: .875rem; color: var(--muted); margin: 0 0 .3rem; }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.pub-venue { font-size: .875rem; color: var(--body); margin: 0; }
.pub-venue em { font-style: normal; color: var(--ink); }
.pub-note {
  font-size: .8rem;
  color: var(--accent-ink);
  margin: .4rem 0 0;
}

.pub-links { margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.doi {
  font-family: var(--mono);
  font-size: .688rem;
  letter-spacing: .02em;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .22rem .5rem;
  color: var(--muted);
  background: var(--bg);
  transition: border-color .15s ease, color .15s ease;
}
.doi:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }

/* the downloadable full text, alongside the DOI rather than instead of it */
.pdf-link {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  font-weight: 500;
  letter-spacing: .08em;
}
.pdf-link:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

/* --- courses -------------------------------------------------------------- */

.course-list { list-style: none; margin: 0; padding: 0; max-width: 920px; }

.course {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line-soft);
  margin: 0;
}
.course:first-child { border-top: 1px solid var(--line); }

.course-code {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 500;
  color: var(--accent-ink);
  padding-top: .18rem;
  letter-spacing: .01em;
}
.course-name {
  color: var(--ink);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 .2rem;
  letter-spacing: -.012em;
}
.course-credits {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .5rem;
}
.course-desc { font-size: .92rem; color: var(--body); margin: 0; }

/* --- students ------------------------------------------------------------- */

/* featured student card (photo + interests) */
.student-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 1.6rem;
  align-items: start;
  max-width: 920px;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.student-photo {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}
.student-photo img { width: 100%; height: 100%; object-fit: cover; }
.student-card .student-name { font-size: 1.12rem; }
.student-interests {
  font-size: .92rem;
  color: var(--body);
  margin: .75rem 0 0;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 700px) {
  .student-card { grid-template-columns: 1fr; gap: 1.1rem; padding: 1.2rem; }
  .student-photo { max-width: 190px; }
}


.student-row { padding: 1.15rem 0; }

.student-name {
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 .15rem;
  letter-spacing: -.012em;
}
.student-affil {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .4rem;
}
.student-project { font-size: .9rem; color: var(--body); margin: 0; }
.student-pub { margin: .55rem 0 0; }

/* the clickable paper marker */
.paper {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .01em;
  padding: .28rem .6rem;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
a.paper:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  transform: translateY(-1px);
}
.paper-mark { font-size: .78em; opacity: .85; }

.paper-pending {
  border-style: dashed;
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

/* --- CV ------------------------------------------------------------------- */

.rows { list-style: none; margin: 0; padding: 0; max-width: 900px; }
.row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 1.25rem;
  padding: .95rem 0;
  border-bottom: 1px solid var(--line-soft);
  margin: 0;
}
.row:first-child { border-top: 1px solid var(--line); }
.row-period {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  padding-top: .18rem;
  font-variant-numeric: tabular-nums;
}
.row-title { color: var(--ink); font-weight: 600; font-size: .97rem; }
.row-sub { font-size: .89rem; color: var(--body); }
.row-note { font-size: .82rem; color: var(--muted); }

.service-block { margin-bottom: 1.4rem; }
.service-block p { margin: 0; }
.service-block .service-items { font-size: .92rem; color: var(--body); }
.service-block .service-link { margin-top: .3rem; font-size: .88rem; }
.service-block .service-link a {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--accent-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.service-block .service-link a:hover { border-bottom-color: currentColor; }

/* --- buttons -------------------------------------------------------------- */

.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .875rem;
  font-weight: 500;
  padding: .55rem 1rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--bg);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }

/* --- news / links list ---------------------------------------------------- */

.news { list-style: none; margin: 0; padding: 0; max-width: 920px; }
.news li {
  padding: .85rem 0;
  border-bottom: 1px solid var(--line-soft);
  margin: 0;
}
.news li:first-child { border-top: 1px solid var(--line); }
.news-source {
  font-family: var(--mono);
  font-size: .656rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: .18rem;
}
.news a { color: var(--ink); font-weight: 500; }
.news a:hover { color: var(--accent-ink); }

/* --- contact strip -------------------------------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}
.contact-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  background: var(--surface);
}
.contact-item .label { margin-bottom: .5rem; }
.contact-item p { margin: 0; font-size: .92rem; }

/* --- footer --------------------------------------------------------------- */

.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 3.5rem;
  padding: 2.6rem 0 3rem;
  background: var(--surface);
}
.foot-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}
.foot-name { color: var(--ink); font-weight: 600; margin: 0 0 .3rem; }
.foot-line { font-size: .85rem; color: var(--muted); margin: 0 0 .2rem; }
.foot-links { list-style: none; padding: 0; margin: 0; }
.foot-links li { margin: 0 0 .25rem; }
.foot-links a { font-size: .85rem; }
.foot-meta { align-self: end; }

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 260px; }
}

/* The nav collapses to a menu button early, because the bar is crowded. */
@media (max-width: 1000px) {
  .head-inner { position: relative; }
  .nav-toggle { display: block; }

  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: .5rem 24px 1rem;
  }
  .site-nav.open { display: block; }
  .site-nav > ul { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav a { padding: .6rem .7rem; }

  /* In the collapsed menu the dropdown is just an indented sub-list. */
  .has-menu::after { content: none; }
  .nav-menu-btn { width: 100%; justify-content: flex-start; padding: .6rem .7rem; cursor: default; }
  .caret { display: none; }
  .dropdown {
    position: static;
    display: block;
    min-width: 0;
    margin: 0 0 .25rem .7rem;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    background: none;
  }
  .dropdown a { padding: .5rem .7rem; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }

  .brand-role { display: none; }

  .course { grid-template-columns: 1fr; gap: .35rem; }
  .course-code { padding-top: 0; }

  .pub { grid-template-columns: 1fr; gap: .3rem; }
  .pub-year { padding-top: 0; }
  .row { grid-template-columns: 1fr; gap: .2rem; }
  .row-period { padding-top: 0; }
}

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

@media print {
  .site-head, .site-nav, .site-foot, .btn-row { display: none; }
  body { font-size: 11pt; color: #000; background: #fff; }
  a { color: #000; }
}
