/* ==========================================================================
   alfonsosantiago.me — stylesheet
   Mobile-first. Single breakpoint at 768px.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  --navy:         #0a1628;
  --navy-soft:    #12233d;

  --teal:         #1D9E75;
  --teal-dark:    #0F6E56;
  --teal-tint:    #E1F5EE;

  --bg:           #ffffff;
  --bg-alt:       #f8fafb;

  --text:         #0f1923;
  --text-muted:   #4a5568;
  --text-on-dark: #e8eef5;
  --text-on-dark-muted: #a8b6c7;

  --border:       #e3e8ee;
  --border-dark:  rgba(255, 255, 255, .14);

  --r-card:       10px;
  --r-pill:       6px;

  --wrap:         860px;
  --nav-h:        64px;

  --shadow-card:  0 1px 2px rgba(15, 25, 35, .04), 0 4px 16px rgba(15, 25, 35, .05);
  --shadow-hover: 0 2px 4px rgba(15, 25, 35, .05), 0 10px 28px rgba(15, 25, 35, .09);

  --ease:         cubic-bezier(.22, .61, .36, 1);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -.02em;
  font-weight: 700;
}

p  { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

a {
  color: var(--teal-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color .18s var(--ease);
}
a:hover { color: var(--teal); }

/* Visible, consistent focus ring everywhere (a11y). */
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  border-radius: 3px;
}

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

/* Skip link — visible only on keyboard focus. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 20px;
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 var(--r-pill) 0;
}
.skip-link:focus {
  left: 0;
  color: #fff;
}

/* --------------------------------------------------------------------------
   3. Nav
   -------------------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 22, 40, .82);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--border-dark);
}

/* Fallback for browsers without backdrop-filter: use an opaque bar. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav { background: var(--navy); }
}

.nav__inner {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav__logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--teal);
  text-decoration: none;
}
.nav__logo:hover { color: #2ec08f; }

.nav__list {
  display: flex;
  gap: 28px;
}
.nav__list a {
  color: var(--text-on-dark);
  text-decoration: none;
  font-size: .9375rem;
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.nav__list a:hover,
.nav__list a.is-active {
  color: #fff;
  border-bottom-color: var(--teal);
}

/* Hamburger button — hidden on desktop. */
.nav__toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0 9px;
  background: none;
  border: 1px solid var(--border-dark);
  border-radius: var(--r-pill);
  cursor: pointer;
  order: 2;
}
.nav__toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-on-dark);
  border-radius: 2px;
  transition: transform .22s var(--ease), opacity .18s var(--ease);
}
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile dropdown */
.nav__menu {
  position: absolute;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--navy);
  border-bottom: 1px solid var(--border-dark);
  overflow: hidden;
  max-height: 0;
  transition: max-height .28s var(--ease);
}
.nav__menu.is-open { max-height: 320px; }

.nav__menu .nav__list {
  flex-direction: column;
  gap: 0;
  padding: 8px 20px 16px;
}
.nav__menu .nav__list a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-dark);
}
.nav__menu .nav__list li:last-child a { border-bottom: none; }

@media (min-width: 768px) {
  .nav__toggle { display: none; }
  .nav__menu {
    position: static;
    max-height: none;
    overflow: visible;
    background: none;
    border-bottom: none;
  }
  .nav__menu .nav__list {
    flex-direction: row;
    gap: 28px;
    padding: 0;
  }
  .nav__menu .nav__list a {
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
  }
  .nav__menu .nav__list li:last-child a { border-bottom: 2px solid transparent; }
}

/* --------------------------------------------------------------------------
   4. Hero
   -------------------------------------------------------------------------- */
.hero {
  background: var(--navy);
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(29, 158, 117, .16), transparent 70%);
  color: var(--text-on-dark);
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  padding-block: 64px;
}

.hero__inner { text-align: center; }

.hero__portrait {
  position: relative;
  width: 128px;
  height: 128px;
  margin: 0 auto 28px;
  border-radius: 50%;
  background: var(--navy-soft);
  border: 2px solid rgba(29, 158, 117, .4);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.hero__monogram {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--teal);
  grid-area: 1 / 1;
}
.hero__photo {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
/* script.js adds this when assets/headshot.jpg fails to load. */
.hero__photo.is-missing { display: none; }

.badge {
  display: inline-block;
  padding: 6px 14px;
  margin-bottom: 22px;
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .01em;
  color: #7fe3bf;
  background: rgba(29, 158, 117, .14);
  border: 1px solid rgba(29, 158, 117, .35);
  border-radius: 999px;
}

.hero__title {
  font-size: clamp(2.5rem, 9vw, 4rem);
  color: #fff;
  margin-bottom: 16px;
}

.hero__subtitle {
  font-size: clamp(1.0625rem, 3.4vw, 1.3125rem);
  color: var(--text-on-dark);
  max-width: 34ch;
  margin: 0 auto 14px;
  line-height: 1.5;
}

.hero__institution {
  font-size: .9375rem;
  color: var(--text-on-dark-muted);
  margin-bottom: 34px;
}

.hero__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 34px;
}

.iconbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: .875rem;
  font-weight: 500;
  color: #9fefd0;
  text-decoration: none;
  border: 1px solid rgba(29, 158, 117, .45);
  border-radius: var(--r-pill);
  transition: background-color .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease), transform .18s var(--ease);
}
.iconbtn:hover {
  background: rgba(29, 158, 117, .16);
  border-color: var(--teal);
  color: #fff;
  transform: translateY(-2px);
}
.iconbtn__icon {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn {
  display: inline-block;
  padding: 13px 30px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--r-pill);
  transition: background-color .18s var(--ease), transform .18s var(--ease),
              box-shadow .18s var(--ease);
}
.btn--primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 4px 14px rgba(29, 158, 117, .3);
}
.btn--primary:hover {
  background: #23b485;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(29, 158, 117, .38);
}

/* --------------------------------------------------------------------------
   5. Section shell
   -------------------------------------------------------------------------- */
.section { padding-block: 72px; }
.section--alt  { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section--dark { background: var(--navy); color: var(--text-on-dark); }

.section__title {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin-bottom: 14px;
}
.section__title--light { color: #fff; }

.section__lead {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 62ch;
  margin-bottom: 40px;
}

.metrics {
  display: block;
  margin-top: 10px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--teal-dark);
}
.metrics__asof {
  font-weight: 400;
  color: var(--text-muted);
}

.subsection__title {
  font-size: 1.375rem;
  margin: 56px 0 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   6. Research cards
   -------------------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 768px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

.card {
  padding: 26px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease),
              border-color .22s var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(29, 158, 117, .4);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  background: var(--teal-tint);
  border-radius: var(--r-pill);
}
.card__icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: var(--teal-dark);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__title {
  font-size: 1.0625rem;
  margin-bottom: 9px;
}
.card__body {
  font-size: .9375rem;
  color: var(--text-muted);
}
.card__media {
  width: 100%;
  margin-top: 16px;
  border-radius: var(--r-pill);
}

/* --------------------------------------------------------------------------
   7. Publications
   -------------------------------------------------------------------------- */
.pubs {
  counter-reset: pub;
  display: grid;
  gap: 14px;
}

.pub {
  counter-increment: pub;
  position: relative;
  padding: 20px 22px 20px 56px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.pub:hover {
  border-color: rgba(29, 158, 117, .45);
  box-shadow: var(--shadow-card);
}
.pub::before {
  content: counter(pub);
  position: absolute;
  left: 20px;
  top: 21px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: .75rem;
  font-weight: 600;
  color: var(--teal-dark);
  background: var(--teal-tint);
  border-radius: 50%;
}

.pub__authors {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.pub__authors strong { color: var(--text); font-weight: 600; }

.pub__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 7px;
}

/* Inline flow (not flex) so the "·" separator stays glued to the end of the
   venue line instead of being orphaned at the start of a wrapped line. */
.pub__meta {
  font-size: .8438rem;
  color: var(--text-muted);
}
.pub__venue { font-style: italic; }
.pub__year::before { content: "· "; }

.pub__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.pub__tags:empty { display: none; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--teal-dark);
  background: var(--teal-tint);
  border-radius: var(--r-pill);
}
.tag--muted {
  color: var(--text-muted);
  background: #eef1f5;
}

.doi {
  display: inline-block;
  padding: 3px 10px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-decoration: none;
  color: var(--teal-dark);
  border: 1px solid rgba(29, 158, 117, .45);
  border-radius: var(--r-pill);
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.doi:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.pubs__more { margin-top: 28px; }

.link-arrow {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid rgba(29, 158, 117, .35);
  padding-bottom: 2px;
  transition: border-color .18s var(--ease);
}
.link-arrow:hover { border-bottom-color: var(--teal); }

/* --------------------------------------------------------------------------
   8. Experience timeline
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
  /* This section has no .section__lead, so add the spacing its 40px would give. */
  margin-top: 26px;
  padding-left: 26px;
  border-left: 2px solid var(--teal-tint);
  display: grid;
  gap: 34px;
}

.tl { position: relative; }

.tl__dot {
  position: absolute;
  left: -52px;
  top: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--teal-dark);
  background: var(--teal-tint);
  border: 2px solid var(--bg);
  border-radius: 50%;
}

.tl__body { padding-left: 4px; }

.tl__role {
  font-size: 1.0625rem;
  margin-bottom: 3px;
}
.tl__org {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--teal-dark);
  margin-bottom: 2px;
}
.tl__type {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: .6875rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #eef1f5;
  border-radius: var(--r-pill);
  vertical-align: 1px;
}
.tl__meta {
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: 9px;
}
.tl__desc {
  font-size: .9375rem;
  color: var(--text-muted);
}

/* On mobile the dot sits above the text instead of in the gutter. */
@media (max-width: 767px) {
  .timeline { padding-left: 20px; }
  .tl__dot {
    position: static;
    margin-bottom: 12px;
  }
}

/* --------------------------------------------------------------------------
   9. Education & awards
   -------------------------------------------------------------------------- */
.edu { display: grid; gap: 20px; }

.edu__item {
  padding-left: 16px;
  border-left: 3px solid var(--teal-tint);
}
.edu__degree {
  font-size: 1rem;
  font-weight: 700;
}
.edu__status {
  margin-left: 6px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-muted);
}
.edu__school {
  font-size: .9375rem;
  color: var(--teal-dark);
  font-weight: 500;
}
.edu__note {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.awards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 768px) {
  .awards { grid-template-columns: repeat(3, 1fr); }
}

.award {
  padding: 20px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.award__title { font-size: .9375rem; margin-bottom: 4px; }
.award__meta {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--teal-dark);
  margin-bottom: 7px;
}
.award__desc { font-size: .875rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   10. Contact & footer
   -------------------------------------------------------------------------- */
.contact__lead {
  font-size: 1.0625rem;
  color: var(--text-on-dark);
  max-width: 56ch;
  margin-bottom: 40px;
}

.contact__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (min-width: 768px) {
  .contact__grid { grid-template-columns: repeat(2, 1fr); }
}

.contact__label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 12px;
}
.contact__list {
  display: grid;
  gap: 8px;
  font-size: .9375rem;
  color: var(--text-on-dark-muted);
}
.contact__list a {
  color: var(--text-on-dark);
  text-decoration: none;
  border-bottom: 1px solid rgba(29, 158, 117, .4);
  padding-bottom: 1px;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.contact__list a:hover {
  color: #7fe3bf;
  border-bottom-color: var(--teal);
}

.footer {
  background: var(--navy);
  border-top: 1px solid var(--border-dark);
  padding-block: 26px;
  font-size: .8125rem;
  color: var(--text-on-dark-muted);
}

/* --------------------------------------------------------------------------
   11. Scroll reveal
   -------------------------------------------------------------------------- */
/* Only applied when JS is running (html.js), so no-JS users see everything. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   12. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
  .card:hover,
  .iconbtn:hover,
  .btn--primary:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   13. Print
   -------------------------------------------------------------------------- */
@media print {
  .nav, .hero__links, .hero__cta, .skip-link { display: none; }
  .hero, .section--dark, .footer {
    background: #fff !important;
    color: #000 !important;
  }
  .hero__title, .section__title--light { color: #000 !important; }
  .contact__lead, .contact__list { color: #000 !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .75em; }
}
