/* ---- Critical (above-the-fold) styles first ---- */
:root{
  --purple:#5e35b1;
  --teal:#26a69a;
  --bg:#fafafa;
  --text:#212121;
  --radius:6px;
  font-size:16px;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;
}
@media (prefers-color-scheme:dark){
 :root{--bg:#121212;--text:#e0e0e0;}
}
*{box-sizing:border-box;margin:0;padding:0}
body{background:var(--bg);color:var(--text);line-height:1.6;-webkit-font-smoothing:antialiased}
h1,h2,h3,h4{font-weight:600;margin-bottom:.6em}
.wrapper{width:min(90%,1100px);margin-inline:auto;padding-block:4rem}
.vh-100{min-height:100vh}
.flex{display:flex}.column{flex-direction:column}.center{justify-content:center;align-items:center}
.btn{display:inline-block;padding:.7em 1.2em;border-radius:var(--radius);text-decoration:none;font-weight:600}
.btn.accent{background:var(--purple);color:#fff}
.btn.outline{border:2px solid var(--purple);color:var(--purple)}
.hidden{display:none}
/* header */
#topbar{position:sticky;top:0;z-index:999;background:rgba(255,255,255,.6);backdrop-filter:saturate(180%) blur(12px);transition:.3s}
#topbar.scrolled{background:var(--bg)}
.wrapper.flex{justify-content:space-between;align-items:center}
.logo{font-weight:600;color:var(--purple);text-decoration:none}
.menu{list-style:none;display:flex;gap:1.5rem}
.menu a{color:var(--text);text-decoration:none;font-weight:600}
.menu a:hover{color:var(--purple)}
/* hamburger on mobile */
#nav-toggle,.hamburger{display:none}
@media(max-width:760px){
.menu{position:fixed;inset:0 0 auto auto;flex-direction:column;background:var(--bg);padding:4rem 2rem;transform:translateY(-100%);transition:.3s}
#nav-toggle:checked~.menu{transform:none}
#nav-toggle,.hamburger{display:block}
.hamburger{width:28px;height:2px;background:var(--text);position:relative;cursor:pointer}
.hamburger::before,.hamburger::after{content:"";position:absolute;width:28px;height:2px;background:inherit;transition:.3s}
.hamburger::before{top:-8px}.hamburger::after{top:8px}
#nav-toggle:checked+.hamburger{background:transparent}
#nav-toggle:checked+.hamburger::before{transform:rotate(45deg) translate(5px,5px)}
#nav-toggle:checked+.hamburger::after{transform:rotate(-45deg) translate(5px,-5px)}
}
/* hero */
#home{position:relative;text-align:center}
#home h1{font-size:clamp(2.5rem,6vw,4rem);color:var(--purple)}
.typewriter{font-size:1.4rem;color:var(--teal);min-height:2.2rem}
.subtitle{margin:.8rem 0 2rem}
.blob{position:absolute;border-radius:50%;filter:blur(60px);opacity:.4;animation:float 20s linear infinite}
.blob1{width:320px;height:320px;background:var(--purple);top:-60px;left:-60px}
.blob2{width:240px;height:240px;background:var(--teal);bottom:-60px;right:-40px}
@keyframes float{0%{transform:translateY(0)}50%{transform:translateY(-30px)}}
/* sections */
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:2rem;align-items:center}
@media(max-width:820px){.grid-2{grid-template-columns:1fr}}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:1rem;margin-top:1rem}
.stats div{background:var(--purple);color:#fff;border-radius:var(--radius);padding:1rem;text-align:center}
.stats span{font-size:1.8rem;display:block}
.timeline{list-style:none;border-left:3px solid var(--purple);margin:2rem 0;padding-left:1.5rem}
.timeline li{position:relative;margin-bottom:1.5rem}
.timeline .dot{position:absolute;left:-11px;top:0;width:16px;height:16px;border-radius:50%;background:var(--purple)}
.timeline time{font-weight:600;color:var(--purple)}
.filters{margin-bottom:1.5rem;text-align:center}
.filters button{background:none;border:2px solid var(--teal);color:var(--teal);padding:.4em 1em;margin:.3em;border-radius:var(--radius);cursor:pointer;font-weight:600}
.filters button.active,.filters button:hover{background:var(--teal);color:#fff}
.repo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:1.2rem}
.repo-card{border:1px solid #dcdcdc;border-radius:var(--radius);padding:1rem;background:#fff;display:flex;flex-direction:column;justify-content:space-between;transition:transform .2s}
.repo-card:hover{transform:translateY(-4px)}
.repo-meta{display:flex;gap:.5rem;font-size:.9rem;margin-top:.6rem;align-items:center}
.tech-tag{background:#eee;border-radius:4px;padding:.15em .4em;font-size:.75rem}
.video-wrapper{position:relative;padding-top:56.25%}
.video-wrapper iframe,.video-wrapper .yt-thumb{position:absolute;inset:0;width:100%;height:100%}
.yt-thumb{cursor:pointer;display:flex;justify-content:center;align-items:center;background:#000}
.yt-thumb span{font-size:4rem;color:#fff}
.pub-list{margin:1rem 0 2rem;line-height:1.4}
.badge{display:inline-block;background:var(--teal);color:#fff;border-radius:4px;padding:.2em .5em;font-size:.75rem;margin-right:.5rem}
.masonry{column-count:3;column-gap:1rem}@media(max-width:760px){.masonry{column-count:2}}
.masonry figure{break-inside:avoid;margin-bottom:1rem;cursor:pointer}
.masonry img{width:100%;border-radius:var(--radius);transition:opacity .2s}
.masonry img:hover{opacity:.8}
/* lightbox */
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.9);display:flex;justify-content:center;align-items:center;z-index:9999}
.lightbox img{max-width:90vw;max-height:90vh}
/* blog */
#post-list article{margin-bottom:2rem}
#post-list h3{margin-bottom:.3em}
/* contact/social */
.social{display:flex;gap:1rem;margin-top:1.5rem}
.social svg{width:24px;height:24px;stroke:var(--text);fill:none;stroke-width:1.8}
.social a:hover svg{stroke:var(--purple)}
/* back to top */
.back-top{position:fixed;right:1.5rem;bottom:1.5rem;background:var(--purple);border:none;border-radius:50%;width:44px;height:44px;display:grid;place-items:center;color:#fff;cursor:pointer;opacity:0;pointer-events:none;transition:.3s}
.back-top.show{opacity:1;pointer-events:auto}
.back-top svg{width:24px;height:24px;stroke:#fff;fill:none;stroke-width:2}
@media print{header,button,iframe,.blob,#backTop{display:none}}

.timeline li .content{
  margin-left: .6rem;   /* ≈ 9 px – adjust to taste */
}

/* ---------- Contact form ---------- */
/* overwrite / complement earlier rules */
/* 2-column alignment with CSS Grid */
/* -------------------------------------------------
   CONTACT  –   Side-by-side labels with big spacing
   ------------------------------------------------- */
.field{
  /* two columns: fixed-width label  +  flexible input */
  display:grid;
  grid-template-columns: 170px 1fr;     /* tweak 170 px to match your design */
  column-gap: 1.2rem;                   /* horizontal gap between label/input */
  align-items:center;

  /* vertical gap to the next .field */
  margin-block: 0 1.6rem;               /* top 0, bottom 1.6 rem  (≈ 25 px) */
}

/* remove the bottom margin after the last row */
.field:last-of-type{ margin-bottom:0; }

.field label{
  font-weight:600;
  text-align:right;                     /* aligns text flush to label column */
}

.field input,
.field textarea{
  width:100%;                           /* make all boxes the same width */
  padding: .65em .85em;
  border:1px solid #bbb;
  border-radius:4px;
  font:inherit;
}

/* --- Mobile: stack label above input, shrink gaps --- */
@media (max-width: 640px){
  .field{
    grid-template-columns:1fr;          /* one column = stacked */
    margin-bottom:1.2rem;               /* slightly tighter on small screens */
  }
  .field label{ text-align:left; }
  .field textarea{ min-height:140px; }  /* nicer size on phones */
}

/* ----------  Publication section tweaks  ---------- */
.pub-list{margin-block:1rem 2rem;line-height:1.55}
.pub-list li{margin-bottom:1.8rem}
.pub-list .badge,
.pub-list strong,
.pub-list em,
.pub-list a,
.pub-list .keywords{display:block}

.pub-full{margin:1rem 0 0 1.1rem;line-height:1.45}
.pub-full li{margin-bottom:1rem}

/* details summary cursor & arrow */
details > summary{cursor:pointer;list-style:none;position:relative;font-weight:600}
details > summary::marker{content:""}     /* hide default arrow */
details > summary::after{
  content:"▼";font-size:.8rem;margin-left:.4rem;transition:.2s}
details[open] > summary::after{transform:rotate(-180deg)}