/* ============================================================================
   Javier Lopetegui — personal site
   Single-page layout, al-folio-inspired palette & typography.
   Change --accent below to re-skin the whole site.
   ========================================================================== */

:root {
  /* --- the one knob that matters ------------------------------------- */
  --accent:        #1a4f9c;          /* deep blue */
  --accent-soft:   rgba(26, 79, 156, 0.10);

  /* --- light theme ---------------------------------------------------- */
  --bg:            #ffffff;
  --bg-alt:        #fafafa;
  --text:          #1c1c1d;
  --text-muted:    #6c757d;
  --border:        #e8e8ea;
  --nav-bg:        rgba(255, 255, 255, 0.82);
  --shadow:        0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-hover:  0 6px 20px rgba(0, 0, 0, 0.09);

  --maxw:          1080px;
  --nav-h:         62px;
  --font-head:     "Roboto Slab", Georgia, serif;
  --font-body:     "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --accent:        #6fa8ff;
  --accent-soft:   rgba(111, 168, 255, 0.14);

  --bg:            #1c1c1d;
  --bg-alt:        #232325;
  --text:          #e6e6e6;
  --text-muted:    #9a9a9e;
  --border:        #313134;
  --nav-bg:        rgba(28, 28, 29, 0.82);
  --shadow:        0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-hover:  0 6px 20px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------- base -- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}
a:hover { opacity: 0.72; text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
}

strong { font-weight: 500; }

section {
  padding: 40px 0;
  scroll-margin-top: calc(var(--nav-h) + 8px);
}

.section-title {
  font-size: 1.75rem;
  font-weight: 300;
  margin-bottom: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* -------------------------------------------------------------- navbar -- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.navbar.scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow);
}

.nav-inner {
  max-width: var(--maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-brand:hover { color: var(--accent); text-decoration: none; opacity: 1; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  position: relative;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.nav-link:hover {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
  opacity: 1;
}
.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.nav-cv {
  border: 1px solid var(--border);
  margin-left: 6px;
}

.theme-toggle {
  margin-left: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

:root[data-theme="light"] .icon-dark  { display: none; }
:root[data-theme="dark"]  .icon-light { display: none; }

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  width: 38px;
  height: 34px;
  cursor: pointer;
}

/* ---------------------------------------------------------------- hero -- */
.hero { padding: 56px 0 30px; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 46px;
  align-items: center;
}

.hero-greeting {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.hero-name {
  font-size: 2.55rem;
  font-weight: 300;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.accent { color: var(--accent); font-weight: 500; }

.hero-tagline {
  margin: 0 0 14px;
  font-size: 1.08rem;
  color: var(--text);
}

.hero-blurb {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 1rem;
}

.hero-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: var(--shadow-hover);
}

/* ------------------------------------------------------------- socials -- */
.socials {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.socials a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 1.15rem;
  transition: all 0.18s ease;
}
.socials a:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  opacity: 1;
  text-decoration: none;
}

/* --------------------------------------------------------------- prose -- */
.prose p {
  margin: 0 0 15px;
  color: var(--text);
}
.prose p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- news -- */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.news-list li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border);
}
.news-list li:last-child { border-bottom: none; }

.news-date {
  font-family: var(--font-head);
  font-size: 0.88rem;
  color: var(--accent);
  padding-top: 2px;
  white-space: nowrap;
}
.news-text { font-size: 0.97rem; }

/* -------------------------------------------------------- publications -- */
.pub {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 26px;
  align-items: start;
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-alt);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.pub:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }


/* The figure spans the full width of the left column, flush with the top of
   the entry — no inset panel around it. */
.pub-preview { align-self: center; }

.pub-preview img {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

.pub-preview--text {
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-family: var(--font-head);
  font-size: 1.05rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
}

.pub-title {
  font-size: 1.14rem;
  margin-bottom: 6px;
}
.pub-authors {
  margin: 0 0 3px;
  font-size: 0.95rem;
  color: var(--text);
}
.pub-venue {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-muted);
}
.pub-abstract {
  margin: 0 0 14px;
  font-size: 0.93rem;
  color: var(--text-muted);
}

.pub-links { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  display: inline-block;
  padding: 3px 13px;
  font-size: 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  background: transparent;
  transition: all 0.15s ease;
}
.btn:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  opacity: 1;
}

.pub-more {
  margin: 14px 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ------------------------------------------------------------ teaching -- */
.teaching-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.teaching-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
}
.teaching-list li:last-child { border-bottom: none; }

.teaching-main { display: flex; flex-direction: column; }
.teaching-course {
  font-family: var(--font-head);
  font-size: 1.02rem;
}
.teaching-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.teaching-date {
  font-size: 0.88rem;
  color: var(--accent);
  white-space: nowrap;
}

/* -------------------------------------------------------------- footer -- */
.footer {
  margin-top: 30px;
  padding: 26px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------- responsive -- */
@media (max-width: 820px) {
  body { font-size: 16px; }

  .nav-toggle { display: block; }

  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 18px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 10px 12px; }
  .theme-toggle { margin: 6px 0 0; width: 100%; }

  .hero { padding: 34px 0 20px; }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .hero-photo {
    order: -1;
    max-width: 155px;
  }
  .hero-name { font-size: 2.05rem; }

  .pub { grid-template-columns: 1fr; gap: 16px; }
  .pub-preview { max-width: 320px; }

  .news-list li { grid-template-columns: 82px 1fr; gap: 12px; }

  .teaching-list li { flex-direction: column; gap: 4px; }
}

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