/* ─────────────────────────────────────────
   Francisco Rau — Personal Academic Site
   ───────────────────────────────────────── */

/* ── Variables ── */
:root {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --bg3:       #21262d;
  --border:    #30363d;
  --text:      #e6edf3;
  --text-muted:#8b949e;
  --accent:    #58a6ff;
  --accent2:   #3fb950;
  --accent3:   #f78166;
  --font:      'Inter', system-ui, sans-serif;
  --mono:      'JetBrains Mono', monospace;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,.35);
  --nav-h:     60px;
  --transition: .2s ease;
}

[data-theme="light"] {
  --bg:        #ffffff;
  --bg2:       #f6f8fa;
  --bg3:       #eaeef2;
  --border:    #d0d7de;
  --text:      #1f2328;
  --text-muted:#57606a;
  --accent:    #0969da;
  --accent2:   #1a7f37;
  --accent3:   #cf222e;
  --shadow:    0 4px 24px rgba(0,0,0,.10);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Container ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 740px; }

/* ──────────────────────────────────────────
   NAV
────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background var(--transition);
}
[data-theme="light"] #navbar {
  background: rgba(255,255,255,.85);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-brand {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .05em;
  text-decoration: none;
}
.nav-links {
  display: flex;
  list-style: none;
  gap: 28px;
  margin-left: auto;
}
.nav-links a {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--text); }
.theme-toggle {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--text);
  font-size: .85rem;
  transition: background var(--transition);
}
.theme-toggle:hover { background: var(--border); }
[data-theme="light"] .icon-moon,
[data-theme="dark"] .icon-sun,
body:not([data-theme]) .icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: inline; }
.nav-burger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  margin-left: 8px;
}
.nav-mobile {
  display: none;
  flex-direction: column;
  list-style: none;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  gap: 12px;
}
.nav-mobile.open { display: flex; }
.nav-mobile a { color: var(--text-muted); font-weight: 500; }

/* ──────────────────────────────────────────
   HERO
────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 48px) 24px 80px;
  position: relative;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(88,166,255,.12) 0%, transparent 70%),
              radial-gradient(ellipse 50% 40% at 80% 80%, rgba(63,185,80,.06) 0%, transparent 60%);
  pointer-events: none;
}
[data-theme="light"] .hero-bg {
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(9,105,218,.08) 0%, transparent 70%);
}
.hero-content { position: relative; max-width: 680px; }
.hero-avatar {
  width: 400px; height: 400px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 24px;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--accent);
  overflow: hidden;
}
.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 30% 20%;
  border-radius: 50%;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 12px;
}
.hero-title {
  font-size: 1rem;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 500;
  margin-bottom: 16px;
  letter-spacing: .02em;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 24px;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}
.badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
}
.hero-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #79b8ff; text-decoration: none; }
[data-theme="light"] .btn-primary:hover { background: #0860c8; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg3); text-decoration: none; }

/* Social row */
.social-row { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
.social-row a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 28px;
  border-radius: 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}
.social-row a:hover { color: var(--accent); border-color: var(--accent); background: var(--border); }
.social-row svg { width: 16px; height: 16px; }

/* Tesla quote */
.tesla-quote {
  padding: 48px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--bg2);
  width: 100%;
  box-sizing: border-box;
}
.tesla-quote blockquote {
  max-width: 720px;
  width: 100%;
  text-align: center;
  border-left: none;
  margin: 0 auto;
  padding: 0 16px;
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.7;
}
.tesla-quote cite {
  display: block;
  margin-top: 12px;
  font-size: .85rem;
  font-style: normal;
  font-family: var(--mono);
  color: var(--accent);
  letter-spacing: .05em;
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .6;
  animation: fadeInUp 2s 1s ease both;
}
.scroll-arrow {
  width: 1px; height: 32px;
  background: linear-gradient(to bottom, var(--text-muted), transparent);
  animation: scrollPulse 2s infinite;
}
@keyframes scrollPulse { 0%,100%{opacity:.3} 50%{opacity:1} }
@keyframes fadeInUp { from{opacity:0;transform:translateX(-50%) translateY(12px)} to{opacity:.6;transform:translateX(-50%) translateY(0)} }

/* ──────────────────────────────────────────
   SECTIONS
────────────────────────────────────────── */
.section { padding: 96px 0; }
.section-alt { background: var(--bg2); }
.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 12px;
  position: relative;
  display: inline-block;
}
.section-title::after {
  content: '';
  display: block;
  height: 3px;
  width: 48px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 8px;
}
.section-sub { color: var(--text-muted); margin-bottom: 40px; font-size: .95rem; }

/* ──────────────────────────────────────────
   ABOUT
────────────────────────────────────────── */
.about-grid { display: grid; grid-template-columns: 1fr 280px; gap: 48px; align-items: start; }
.about-text p { margin-bottom: 16px; color: var(--text-muted); text-align: justify; }
.about-text p strong { color: var(--text); }
.interest-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.interest-tags span {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: .8rem;
  color: var(--accent);
}
.about-info { display: flex; flex-direction: column; gap: 16px; }
.info-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.section-alt .info-card { background: var(--bg); }
.info-card h4 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px; }
.info-card p { font-size: .9rem; color: var(--text); }

/* ──────────────────────────────────────────
   PUBLICATIONS
────────────────────────────────────────── */
.pub-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px; }
.pub-filter {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.pub-filter.active,
.pub-filter:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.pub-list { display: flex; flex-direction: column; gap: 20px; }
.pub-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  gap: 20px;
  transition: border-color var(--transition), transform var(--transition);
}
.pub-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.pub-card.hidden { display: none; }
.pub-type {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 8px 6px;
  border-radius: 6px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: fit-content;
}
.pub-type.journal  { background: rgba(88,166,255,.15); color: var(--accent); }
.pub-type.conference { background: rgba(63,185,80,.15); color: var(--accent2); }
.pub-type.preprint { background: rgba(247,129,102,.15); color: var(--accent3); }
.pub-type.dataset  { background: rgba(163,113,247,.15); color: #a371f7; }
.pub-body { flex: 1; }
.pub-title { font-size: 1rem; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }
.pub-authors { font-size: .875rem; color: var(--text-muted); margin-bottom: 4px; }
.pub-venue { font-size: .875rem; color: var(--text-muted); margin-bottom: 10px; }
.pub-abstract { font-size: .85rem; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }
.pub-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pub-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 12px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.pub-tag:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ──────────────────────────────────────────
   PROJECTS
────────────────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.project-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition), transform var(--transition);
}
.project-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.project-header { display: flex; justify-content: space-between; align-items: center; }
.project-icon { font-size: 1.6rem; }
.project-status {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 20px;
}
.project-status.active  { background: rgba(63,185,80,.15); color: var(--accent2); }
.project-status.past    { background: var(--bg3); color: var(--text-muted); }
.project-card h3 { font-size: 1rem; font-weight: 600; line-height: 1.35; }
.project-card p { font-size: .875rem; color: var(--text-muted); flex: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-tags span {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: .75rem;
  color: var(--text-muted);
}
.project-links { display: flex; gap: 12px; }
.project-links a { font-size: .85rem; font-weight: 500; color: var(--accent); }

/* ──────────────────────────────────────────
   CV
────────────────────────────────────────── */
.cv-download { margin-bottom: 40px; }
.cv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.cv-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.cv-block-full { grid-column: 1 / -1; }
.cv-block-title { font-size: .95rem; font-weight: 700; margin-bottom: 20px; letter-spacing: .02em; }
.cv-items { display: flex; flex-direction: column; gap: 20px; }
.cv-item { display: grid; grid-template-columns: 100px 1fr; gap: 12px; }
.cv-item-year { font-size: .78rem; font-family: var(--mono); color: var(--accent); padding-top: 3px; }
.cv-item-body strong { display: block; font-size: .9rem; line-height: 1.35; margin-bottom: 2px; }
.cv-item-sub { font-size: .82rem; color: var(--text-muted); }
.cv-item-desc { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.skill-group h5 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 8px; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-tags span {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 12px;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ──────────────────────────────────────────
   GALLERY
────────────────────────────────────────── */
.gallery-masonry {
  columns: 3;
  column-gap: 16px;
}
.gallery-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg3);
}
.gallery-item img {
  width: 100%;
  display: block;
  transition: transform .4s ease;
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 55%);
  opacity: 0;
  transition: opacity .3s ease;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }
.gallery-overlay span {
  color: #fff;
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.93);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 60px 80px 40px;
  box-sizing: border-box;
}
.lightbox.open { display: flex; }
.lb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}
.lb-content img {
  max-width: min(90vw, 1200px);
  max-height: 80vh;
  width: auto;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 8px 48px rgba(0,0,0,.8);
  object-fit: contain;
  display: block;
}
.lb-caption {
  color: rgba(255,255,255,.9);
  font-size: .95rem;
  margin-top: 16px;
  text-align: center;
  max-width: min(90vw, 1200px);
  line-height: 1.5;
  letter-spacing: .01em;
}
.lb-close {
  position: fixed;
  top: 16px; right: 20px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  color: #fff; font-size: 1.6rem;
  width: 40px; height: 40px;
  cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.lb-close:hover { background: rgba(255,255,255,.25); }
.lb-prev, .lb-next {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-size: 1.8rem;
  width: 48px; height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.25); }
@media (max-width: 600px) {
  .lightbox { padding: 50px 10px 30px; }
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
}

@media (max-width: 860px) {
  .gallery-masonry { columns: 2; }
}
@media (max-width: 500px) {
  .gallery-masonry { columns: 1; }
}

/* ──────────────────────────────────────────
   CONTACT
────────────────────────────────────────── */
.contact-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.contact-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.contact-icon { font-size: 1.5rem; }
.contact-card strong { display: block; font-size: .9rem; margin-bottom: 2px; }
.contact-card span { font-size: .82rem; color: var(--text-muted); }

/* ──────────────────────────────────────────
   FOOTER
────────────────────────────────────────── */
footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 28px 24px;
  font-size: .82rem;
  color: var(--text-muted);
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--accent); }

/* ──────────────────────────────────────────
   ANIMATIONS (entrance)
────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .5s ease, transform .5s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ──────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────── */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .cv-grid { grid-template-columns: 1fr; }
  .cv-block-full { grid-column: 1; }
}
@media (max-width: 640px) {
  .nav-links, .theme-toggle { display: none; }
  .nav-burger { display: block; }
  .pub-card { flex-direction: column; gap: 12px; }
  .pub-type { writing-mode: horizontal-tb; width: fit-content; padding: 3px 12px; }
  .cv-item { grid-template-columns: 1fr; gap: 4px; }
  .cv-item-year { padding-top: 0; }
}
