/* ============================================================
   main.css — Alex Sopio personal site
   Dark space/physics theme
   ============================================================ */

/* ---------- CSS custom properties ---------- */
:root {
  --bg:          #080c14;
  --surface:     #0d1221;
  --surface-2:   #111827;
  --border:      #1e2d45;
  --accent:      #60a5fa;   /* electric blue  */
  --accent-2:    #a78bfa;   /* violet / AI    */
  --accent-glow: rgba(96, 165, 250, 0.15);
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --text-faint:  #4b5c75;
  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 4px 24px rgba(0,0,0,.45);
  --transition:  150ms cubic-bezier(.4,0,.2,1);
  --max-w:       760px;
  --max-w-wide:  1100px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* subtle star-field texture */
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(96,165,250,.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 90%, rgba(167,139,250,.05) 0%, transparent 60%);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #93c5fd; }

img { max-width: 100%; border-radius: var(--radius); }

p { margin-bottom: 1.1rem; }
p:last-child { margin-bottom: 0; }

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}
h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: .75rem; }
h3 { font-size: 1.15rem; margin-top: 1.5rem; margin-bottom: .5rem; }

code, pre {
  font-family: var(--font-mono);
  font-size: .87em;
}

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .15em .4em;
  color: var(--accent);
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  margin-bottom: 1.4rem;
}

pre code { background: none; border: none; padding: 0; color: var(--text); }

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 1.5rem 0;
}

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

ul, ol { padding-left: 1.5rem; margin-bottom: 1.1rem; }
li { margin-bottom: .35rem; }

/* ---------- Layout helpers ---------- */
.container {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.content-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Site header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,12,20,.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.site-logo {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: .01em;
  white-space: nowrap;
}
.site-logo:hover { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.site-nav a {
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 500;
  padding: .4rem .7rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--text);
  background: var(--surface-2);
}
.site-nav a.active { color: var(--accent); }

/* hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all var(--transition);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Main ---------- */
.site-main { min-height: calc(100vh - 62px - 90px); }

/* ---------- Hero ---------- */
.hero {
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(96,165,250,.12) 0%, transparent 65%);
  pointer-events: none;
}

.hero-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid var(--border);
  box-shadow: 0 0 0 6px var(--accent-glow), var(--shadow);
  margin: 0 auto 1.5rem;
  display: block;
  object-fit: cover;
  background: var(--surface-2);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -.03em;
  margin-bottom: .5rem;
  background: linear-gradient(135deg, #e2e8f0 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
  font-weight: 400;
}

.hero-affiliation {
  font-size: .92rem;
  color: var(--text-faint);
  margin-bottom: 2rem;
  font-family: var(--font-mono);
}

.hero-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  transition: all var(--transition);
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #06111e;
}
.btn-primary:hover {
  background: #93c5fd;
  color: #06111e;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(96,165,250,.35);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

/* ---------- Sections ---------- */
.section {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.section-title .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), var(--shadow);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .4rem;
}

.card-meta {
  font-size: .8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: .6rem;
}

.card-desc {
  font-size: .9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .8rem;
}

.tag {
  font-size: .75rem;
  font-family: var(--font-mono);
  padding: .2em .55em;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent-2);
}

/* ---------- Publication list ---------- */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.pub-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  transition: border-color var(--transition);
}
.pub-item:hover { border-color: var(--accent); }

.pub-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .35rem;
}

.pub-authors {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .3rem;
}

.pub-journal {
  font-size: .82rem;
  font-style: italic;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin-bottom: .7rem;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.pub-link {
  font-size: .78rem;
  padding: .25em .65em;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--accent);
  transition: all var(--transition);
}
.pub-link:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Talks list ---------- */
.talk-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.talk-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1.2rem;
  align-items: start;
  padding: 1.2rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition);
}
.talk-item:hover { border-color: var(--accent-2); }

.talk-year {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--accent-2);
  padding-top: .2rem;
}

.talk-title {
  font-size: .97rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .3rem;
}

.talk-venue {
  font-size: .84rem;
  color: var(--text-muted);
}

/* ---------- Blog post list ---------- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.post-item:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateX(3px);
}

.post-date {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-faint);
  flex-shrink: 0;
  min-width: 90px;
}

.post-title {
  font-size: .97rem;
  font-weight: 500;
  color: var(--text);
}
.post-item:hover .post-title { color: var(--accent); }

/* ---------- Post page ---------- */
.post-header {
  padding: 3.5rem 1.5rem 2rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.post-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: 1rem;
}

.post-meta {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  align-items: center;
}

.post-meta span::before { content: '·'; margin-right: .8rem; }
.post-meta span:first-child::before { content: ''; margin-right: 0; }

.post-body {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.post-body h1, .post-body h2, .post-body h3 { scroll-margin-top: 80px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.back-link:hover { color: var(--accent); }

/* ---------- Page header ---------- */
.page-header {
  padding: 3.5rem 1.5rem 1.5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}

.page-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  margin-bottom: .5rem;
}

.page-header .lead {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 540px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.8rem 0;
  background: var(--surface);
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .83rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent); }

.footer-copy {
  font-size: .78rem;
  color: var(--text-faint);
}

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: 63px;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: rgba(8,12,20,.97);
    border-bottom: 1px solid var(--border);
    padding: .75rem 1rem;
    gap: .25rem;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: .6rem .8rem; }

  .talk-item { grid-template-columns: 1fr; gap: .3rem; }
  .talk-year { padding-top: 0; }

  .site-footer .container { flex-direction: column; align-items: flex-start; }

  .card-grid { grid-template-columns: 1fr; }

  .hero { padding: 3.5rem 1.5rem 3rem; }
}
